mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 05:53:52 +08:00
DEV: Convert min_trust_level_to_tag_topics to groups (#25258)
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_level_to_tag_topics site setting to tag_topic_allowed_groups.
This commit is contained in:
@ -3708,7 +3708,7 @@ RSpec.describe Guardian do
|
||||
context "when tagging is enabled" do
|
||||
before do
|
||||
SiteSetting.tagging_enabled = true
|
||||
SiteSetting.min_trust_level_to_tag_topics = 1
|
||||
SiteSetting.tag_topic_allowed_groups = Group::AUTO_GROUPS[:trust_level_1]
|
||||
end
|
||||
|
||||
context "when minimum trust level to create tags is 3" do
|
||||
@ -3739,11 +3739,19 @@ RSpec.describe Guardian do
|
||||
|
||||
describe "can_tag_topics" do
|
||||
it "returns false if trust level is too low" do
|
||||
expect(Guardian.new(Fabricate(:user, trust_level: 0)).can_tag_topics?).to be_falsey
|
||||
expect(
|
||||
Guardian.new(
|
||||
Fabricate(:user, trust_level: 0, refresh_auto_groups: true),
|
||||
).can_tag_topics?,
|
||||
).to be_falsey
|
||||
end
|
||||
|
||||
it "returns true if trust level is high enough" do
|
||||
expect(Guardian.new(Fabricate(:user, trust_level: 1)).can_tag_topics?).to be_truthy
|
||||
expect(
|
||||
Guardian.new(
|
||||
Fabricate(:user, trust_level: 1, refresh_auto_groups: true),
|
||||
).can_tag_topics?,
|
||||
).to be_truthy
|
||||
end
|
||||
|
||||
it "returns true for staff" do
|
||||
|
Reference in New Issue
Block a user