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

@ -1027,6 +1027,31 @@ RSpec.describe TopicsController do
expect(topic.tags.pluck(:id)).to contain_exactly(tag.id)
end
it "can add a tag to wiki topic" do
SiteSetting.min_trust_to_edit_wiki_post = 2
topic.first_post.update!(wiki: true)
user = Fabricate(:user)
sign_in(user)
expect do
put "/t/#{topic.id}/tags.json", params: {
tags: [tag.name]
}
end.not_to change { topic.reload.first_post.revisions.count }
expect(response.status).to eq(403)
user.update!(trust_level: 2)
expect do
put "/t/#{topic.id}/tags.json", params: {
tags: [tag.name]
}
end.to change { topic.reload.first_post.revisions.count }.by(1)
expect(response.status).to eq(200)
expect(topic.tags.pluck(:id)).to contain_exactly(tag.id)
end
it 'does not remove tag if no params is given' do
topic.tags << tag