2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-12 21:10:47 +08:00

do not notify staged users about posts withing mailinglist mirror category

This commit is contained in:
Gerhard Schlager 2017-11-17 14:50:35 +01:00
parent 1a3ab7c02e
commit d47fa6653b
2 changed files with 17 additions and 0 deletions

View file

@ -627,6 +627,21 @@ describe PostAlerter do
expect(dave.notifications.count).to eq(1)
expect(erin.notifications.count).to eq(1)
end

it "does not send email notifications to staged users when notification originates in mailinglist mirror category" do
category = Fabricate(:mailinglist_mirror_category)
topic = Fabricate(:topic, category: category)
user = Fabricate(:staged)
post = Fabricate(:post, user: user, topic: topic)
reply = Fabricate(:post, topic: topic, reply_to_post_number: 1)

NotificationEmailer.expects(:process_notification).never
expect { PostAlerter.post_created(reply) }.to change(user.notifications, :count).by(0)

category.mailinglist_mirror = false
NotificationEmailer.expects(:process_notification).once
expect { PostAlerter.post_created(reply) }.to change(user.notifications, :count).by(1)
end
end

context "watching" do