mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:34:31 +08:00
DEV: Convert min_trust_to_allow_self_wiki to groups (#25009)
We're changing the implementation of trust levels to use groups. Part of this is to have site settings that reference trust levels use groups instead. It converts the min_trust_to_allow_self_wiki site setting to self_wiki_allowed_groups. Nothing of note here. This is used in exactly one place, and there's no fallout.
This commit is contained in:
@ -3649,12 +3649,12 @@ RSpec.describe Guardian do
|
||||
end
|
||||
|
||||
it "returns false when user satisfies trust level but tries to wiki someone else's post" do
|
||||
SiteSetting.min_trust_to_allow_self_wiki = 2
|
||||
SiteSetting.self_wiki_allowed_groups = Group::AUTO_GROUPS[:trust_level_2]
|
||||
expect(Guardian.new(trust_level_2).can_wiki?(post)).to be_falsey
|
||||
end
|
||||
|
||||
it "returns true when user satisfies trust level and owns the post" do
|
||||
SiteSetting.min_trust_to_allow_self_wiki = 2
|
||||
SiteSetting.self_wiki_allowed_groups = Group::AUTO_GROUPS[:trust_level_2]
|
||||
own_post = Fabricate(:post, user: trust_level_2)
|
||||
expect(Guardian.new(trust_level_2).can_wiki?(own_post)).to be_truthy
|
||||
end
|
||||
|
Reference in New Issue
Block a user