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:
Ted Johansson
2023-12-27 09:21:39 +08:00
committed by GitHub
parent 3c818ff07e
commit b890eb1bd2
6 changed files with 39 additions and 3 deletions

View File

@ -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