FIX: Don't show the get a room composer message in private categories (#12702)

This commit is contained in:
Mark VanLandingham 2021-04-14 12:34:13 -05:00 committed by GitHub
parent dda1cd6a38
commit 1d85574d52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -151,6 +151,7 @@ class ComposerMessagesFinder
def check_get_a_room(min_users_posted: 5)
return unless educate_reply?(:notified_about_get_a_room)
return unless @details[:post_id].present?
return if @topic.category&.read_restricted
reply_to_user_id = Post.where(id: @details[:post_id]).pluck(:user_id)[0]

View File

@ -343,6 +343,13 @@ describe ComposerMessagesFinder do
expect(ComposerMessagesFinder.new(user, composer_action: 'reply').check_get_a_room(min_users_posted: 2)).to be_blank
end
it "does not give a message if the topic's category is read_restricted" do
topic.category.update(read_restricted: true)
finder = ComposerMessagesFinder.new(user, composer_action: 'reply', topic_id: topic.id, post_id: op.id)
finder.check_get_a_room(min_users_posted: 2)
expect(UserHistory.exists_for_user?(user, :notified_about_get_a_room)).to eq(false)
end
context "reply" do
let(:finder) { ComposerMessagesFinder.new(user, composer_action: 'reply', topic_id: topic.id, post_id: op.id) }