mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: TL0 could not message group with everyone messageable_level (#19525)
The commitse62e93f83aandd6bd4ad7eecaused a regression to the behaviour added for https://meta.discourse.org/t/allow-tl0-to-write-messages-to-staff-group-not-to-other-members-or-non-staff/124335, which allowed a user to message a group with the messageable_level set to Everyone even if they were TL0 (or otherwise did not reach the appropriate trust level). This commit fixes the issue and adjusts the spec to reflect the real scenario. c.f. https://meta.discourse.org/t/tl0-cant-message-groups-with-messageable-level-everyone-recession/249205
This commit is contained in:
@@ -364,9 +364,9 @@ RSpec.describe Guardian do
|
||||
end
|
||||
end
|
||||
|
||||
it "allows TL0 to message group with messageable_level = everyone" do
|
||||
it "allows TL0 to message group with messageable_level = everyone regardless of personal_message_enabled_groups" do
|
||||
group.update!(messageable_level: Group::ALIAS_LEVELS[:everyone])
|
||||
SiteSetting.personal_message_enabled_groups = Group::AUTO_GROUPS[:trust_level_0]
|
||||
SiteSetting.personal_message_enabled_groups = Group::AUTO_GROUPS[:trust_level_1]
|
||||
expect(Guardian.new(trust_level_0).can_send_private_message?(group)).to eq(true)
|
||||
expect(Guardian.new(user).can_send_private_message?(group)).to eq(true)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user