mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: wiki editors are allowed edit tags for wiki topics.
If a wiki editor's TL is greater than 'min trust level to tag topics' site setting then they can edit the tags for any wiki topic.
This commit is contained in:
@@ -257,6 +257,26 @@ describe TopicViewSerializer do
|
||||
expect(details[:allowed_users].find { |au| au[:id] == pm.user_id }).to be_present
|
||||
expect(details[:allowed_groups].find { |ag| ag[:id] == group.id }).to be_present
|
||||
end
|
||||
|
||||
context "can_edit_tags" do
|
||||
before do
|
||||
SiteSetting.tagging_enabled = true
|
||||
SiteSetting.min_trust_to_edit_wiki_post = 2
|
||||
end
|
||||
|
||||
it "returns true when user can edit a wiki topic" do
|
||||
post = Fabricate(:post, wiki: true)
|
||||
topic = Fabricate(:topic, first_post: post)
|
||||
|
||||
json = serialize_topic(topic, user)
|
||||
expect(json[:details][:can_edit_tags]).to be_nil
|
||||
|
||||
user.update!(trust_level: 2)
|
||||
|
||||
json = serialize_topic(topic, user)
|
||||
expect(json[:details][:can_edit_tags]).to eq(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user