FIX: topics tagged with muted tags should not be included in digest emails

This commit is contained in:
Neil Lalonde
2016-08-08 15:14:18 -04:00
parent fb1b119462
commit 17b51bb465
2 changed files with 25 additions and 0 deletions

View File

@ -1364,6 +1364,24 @@ describe Topic do
expect(Topic.for_digest(u, 1.year.ago, top_order: true)).to eq([topic])
end
it "doesn't return topics with only muted tags" do
user = Fabricate(:user)
tag = Fabricate(:tag)
TagUser.change(user.id, tag.id, TagUser.notification_levels[:muted])
topic = Fabricate(:topic, tags: [tag])
expect(Topic.for_digest(user, 1.year.ago, top_order: true)).to be_blank
end
it "returns topics with both muted and not muted tags" do
user = Fabricate(:user)
muted_tag, other_tag = Fabricate(:tag), Fabricate(:tag)
TagUser.change(user.id, muted_tag.id, TagUser.notification_levels[:muted])
topic = Fabricate(:topic, tags: [muted_tag, other_tag])
expect(Topic.for_digest(user, 1.year.ago, top_order: true)).to eq([topic])
end
end
describe 'secured' do