mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 04:08:41 +08:00
DEV: Convert min_trust_level_to_tag_topics to groups (#25273)
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:
@ -7,7 +7,7 @@ RSpec.describe PostRevisor do
|
||||
fab!(:newuser) { Fabricate(:newuser, last_seen_at: Date.today) }
|
||||
fab!(:user) { Fabricate(:user, refresh_auto_groups: true) }
|
||||
fab!(:coding_horror)
|
||||
fab!(:admin)
|
||||
fab!(:admin) { Fabricate(:admin, refresh_auto_groups: true) }
|
||||
fab!(:moderator)
|
||||
let(:post_args) { { user: newuser, topic: topic } }
|
||||
|
||||
@ -101,7 +101,7 @@ RSpec.describe PostRevisor do
|
||||
|
||||
it "does not revise category if incorrect amount of tags" do
|
||||
SiteSetting.create_tag_allowed_groups = Group::AUTO_GROUPS[:trust_level_0]
|
||||
SiteSetting.min_trust_level_to_tag_topics = 0
|
||||
SiteSetting.tag_topic_allowed_groups = Group::AUTO_GROUPS[:trust_level_0]
|
||||
|
||||
new_category = Fabricate(:category, minimum_required_tags: 1)
|
||||
|
||||
@ -123,7 +123,7 @@ RSpec.describe PostRevisor do
|
||||
|
||||
it "returns an error if the topic does not have minimum amount of tags that the new category requires" do
|
||||
SiteSetting.create_tag_allowed_groups = Group::AUTO_GROUPS[:trust_level_0]
|
||||
SiteSetting.min_trust_level_to_tag_topics = 0
|
||||
SiteSetting.tag_topic_allowed_groups = Group::AUTO_GROUPS[:trust_level_0]
|
||||
|
||||
old_category = Fabricate(:category, minimum_required_tags: 0)
|
||||
new_category = Fabricate(:category, minimum_required_tags: 1)
|
||||
@ -137,7 +137,7 @@ RSpec.describe PostRevisor do
|
||||
|
||||
it "returns an error if the topic has tags not allowed in the new category" do
|
||||
SiteSetting.create_tag_allowed_groups = Group::AUTO_GROUPS[:trust_level_0]
|
||||
SiteSetting.min_trust_level_to_tag_topics = 0
|
||||
SiteSetting.tag_topic_allowed_groups = Group::AUTO_GROUPS[:trust_level_0]
|
||||
|
||||
tag1 = Fabricate(:tag)
|
||||
tag2 = Fabricate(:tag)
|
||||
@ -165,7 +165,7 @@ RSpec.describe PostRevisor do
|
||||
|
||||
it "returns an error if the topic is missing tags required from a tag group in the new category" do
|
||||
SiteSetting.create_tag_allowed_groups = Group::AUTO_GROUPS[:trust_level_0]
|
||||
SiteSetting.min_trust_level_to_tag_topics = 0
|
||||
SiteSetting.tag_topic_allowed_groups = Group::AUTO_GROUPS[:trust_level_0]
|
||||
|
||||
tag1 = Fabricate(:tag)
|
||||
tag_group = Fabricate(:tag_group, tags: [tag1])
|
||||
@ -1233,7 +1233,7 @@ RSpec.describe PostRevisor do
|
||||
context "when can create tags" do
|
||||
before do
|
||||
SiteSetting.create_tag_allowed_groups = "1|3|#{Group::AUTO_GROUPS[:trust_level_0]}"
|
||||
SiteSetting.min_trust_level_to_tag_topics = 0
|
||||
SiteSetting.tag_topic_allowed_groups = "1|3|#{Group::AUTO_GROUPS[:trust_level_0]}"
|
||||
end
|
||||
|
||||
it "can create all tags if none exist" do
|
||||
@ -1491,7 +1491,7 @@ RSpec.describe PostRevisor do
|
||||
context "when cannot create tags" do
|
||||
before do
|
||||
SiteSetting.create_tag_allowed_groups = Group::AUTO_GROUPS[:trust_level_4]
|
||||
SiteSetting.min_trust_level_to_tag_topics = 0
|
||||
SiteSetting.tag_topic_allowed_groups = Group::AUTO_GROUPS[:trust_level_0]
|
||||
end
|
||||
|
||||
it "only uses existing tags" do
|
||||
|
Reference in New Issue
Block a user