mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
FIX: Don't show the get a room composer message in private categories (#12702)
This commit is contained in:
parent
dda1cd6a38
commit
1d85574d52
|
@ -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]
|
||||
|
||||
|
|
|
@ -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) }
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user