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:
Vinoth Kannan
2019-10-23 23:35:38 +05:30
parent 67ad8fbd1b
commit 31577b2131
12 changed files with 115 additions and 24 deletions

View File

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