FIX: do not show send pm prompt when user cant pm (#25912)
Prior to this fix even when the user was not part of a group allowing sending pm we would show the prompt: "You've replied to ... X times, did you know you could send them a personal message instead?"
This commit is contained in:
parent
3736d66f17
commit
64e8ad170e
|
@ -181,6 +181,7 @@ class ComposerMessagesFinder
|
|||
end
|
||||
|
||||
def check_get_a_room(min_users_posted: 5)
|
||||
return unless @user.guardian.can_send_private_messages?
|
||||
return unless educate_reply?(:notified_about_get_a_room)
|
||||
return unless @details[:post_id].present?
|
||||
return if @topic.category&.read_restricted
|
||||
|
|
|
@ -441,6 +441,23 @@ RSpec.describe ComposerMessagesFinder do
|
|||
SiteSetting.educate_until_posts = 10
|
||||
user.stubs(:post_count).returns(11)
|
||||
SiteSetting.get_a_room_threshold = 2
|
||||
SiteSetting.personal_message_enabled_groups = Group::AUTO_GROUPS[:everyone]
|
||||
end
|
||||
|
||||
context "when user can't send private messages" do
|
||||
fab!(:group) { Fabricate(:group) }
|
||||
before { SiteSetting.personal_message_enabled_groups = group.id }
|
||||
|
||||
it "does not show the message" do
|
||||
expect(
|
||||
ComposerMessagesFinder.new(
|
||||
user,
|
||||
composer_action: "reply",
|
||||
topic_id: topic.id,
|
||||
post_id: op.id,
|
||||
).check_get_a_room(min_users_posted: 2),
|
||||
).to be_blank
|
||||
end
|
||||
end
|
||||
|
||||
it "does not show the message for new topics" do
|
||||
|
|
Loading…
Reference in New Issue