FIX: don't bump topics when hidden tags are added or removed

This commit is contained in:
Neil Lalonde
2019-05-06 14:51:51 -04:00
parent 39260c841e
commit 5de750d373
3 changed files with 52 additions and 1 deletions

View File

@@ -740,6 +740,31 @@ describe PostRevisor do
end
end
context "hidden tags" do
let(:bumped_at) { 1.day.ago }
before do
topic.update_attributes!(bumped_at: bumped_at)
create_hidden_tags(['important', 'secret'])
topic = post.topic
topic.tags = [Fabricate(:tag, name: "super"), Tag.where(name: "important").first, Fabricate(:tag, name: "stuff")]
end
it "doesn't bump topic if only staff-only tags are added" do
expect {
result = subject.revise!(Fabricate(:admin), raw: post.raw, tags: topic.tags.map(&:name) + ['secret'])
expect(result).to eq(true)
}.to_not change { topic.reload.bumped_at }
end
it "doesn't bump topic if only staff-only tags are removed" do
expect {
result = subject.revise!(Fabricate(:admin), raw: post.raw, tags: topic.tags.map(&:name) - ['important', 'secret'])
expect(result).to eq(true)
}.to_not change { topic.reload.bumped_at }
end
end
end
context "cannot create tags" do