mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 13:51:09 +08: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:
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user