mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: do not notify admins about PMs when suppress is on (#31232)
When `suppress_secured_categories_from_admin` SiteSetting is enabled, it is expected that the admin will not be notified about PMs in which they are not participating - even when they watch the attributed tag. Before it was only checking if the admin had access to a secured category assigned to a regular topic. PMs do not have categories so we need to ensure that admin in participating in that conversation.
This commit is contained in:
committed by
GitHub
parent
b46718f628
commit
cc9301a16d
@@ -927,6 +927,20 @@ RSpec.describe Guardian do
|
||||
|
||||
expect(Guardian.new(admin).can_receive_post_notifications?(post)).to be_truthy
|
||||
end
|
||||
|
||||
it "disallows private messages with no access" do
|
||||
post = Fabricate(:private_message_post, user: moderator)
|
||||
|
||||
expect(Guardian.new(trust_level_0).can_receive_post_notifications?(post)).to be_falsey
|
||||
expect(Guardian.new(admin).can_receive_post_notifications?(post)).to be_truthy
|
||||
|
||||
SiteSetting.suppress_secured_categories_from_admin = true
|
||||
|
||||
expect(Guardian.new(admin).can_receive_post_notifications?(post)).to be_falsey
|
||||
|
||||
post.topic.allowed_users << admin
|
||||
expect(Guardian.new(admin).can_receive_post_notifications?(post)).to be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
describe "can_see?" do
|
||||
|
||||
Reference in New Issue
Block a user