FIX: Don't notify topic author about small action posts (#18789)

This commit is contained in:
Osama Sayegh 2022-10-31 01:26:20 +03:00 committed by GitHub
parent 5ee5031bfa
commit fa9e708cb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 2 deletions

View File

@ -146,8 +146,8 @@ class PostAlerter
# replies
reply_to_user = post.reply_notification_target
if new_record
if reply_to_user && !notified.include?(reply_to_user) && notify_about_reply?(post)
if new_record && notify_about_reply?(post)
if reply_to_user && !notified.include?(reply_to_user)
notified += notify_non_pm_users(reply_to_user, :replied, post)
end

View File

@ -1343,6 +1343,21 @@ RSpec.describe PostAlerter do
read: false
)).to eq(true)
end
it "it doesn't notify about small action posts when the topic author is watching the topic " do
Jobs.run_immediately!
u1 = Fabricate(:admin)
u2 = Fabricate(:admin)
topic = create_topic(user: u1)
u1.notifications.destroy_all
expect do
topic.update_status("closed", true, u2, message: "hello world")
end.not_to change { u1.reload.notifications.count }
end
end
context "with category" do