Receiving multiple notifications about the same reply

The first time I noticed a second notification for the same reply while no link, quote or mention was added in the edit was after the edit on Topics from some categories do not appear on /latest - #36 by JammyDodger. This case is slightly different than my repro steps below, but I think the underlying issue is the same.

The second post where this happened was on Messages section for sidebar - #13 by nathank. It was similar: The edit didn’t add anything that would result in a notification - the quotes both had been there before - and still I was notified a second time.

Here are the steps to reproduce I found that worked [1]

You need 3 users: OP, notifiedUser, spammer

  1. OP creates a topic
  2. notifiedUser replies
  3. OP replies to the post of notified user
    notifiedUser is notified about the reply (expected)
  4. spammer replies to the post of notifiedUser. The reply contains a link to another post by notifiedUser and a quote from the post you reply to. (optional: you can also @mention notifiedUser)
    notifiedUser is notified about the reply (expected)
    [In case you added an @mention the notification is about the @mention (expected)]
  5. notifiedUser reads the new replies to mark the notifications as read and navigates back somewhere else so we won’t miss a notification.
  6. spammer edits the reply and fixes a typo (or adds edit1)
    notifiedUser is notified about being quoted (unexpected, they were notified about this reply before and the quote has been there before, no need to tell them)
  7. spammer edits the reply again to fix another typo (or adds edit2)
    notifiedUser is notified about being linked (unexpected, they were notified about this reply before and the link has been there before, no need to tell them)

The video only shows the final steps 5-7. Spammer is on the left, notifiedUser on the right


  1. at least most of the time, sometimes even adding an @mention in the edit doesn’t trigger a new notification ↩︎

2 Likes

In post_alerter.rb

Change lines 589-599 from:
 # linked, quoted, mentioned, chat_quoted may be suppressed if you already have a reply notification
 if [
      Notification.types[:quoted],
      Notification.types[:linked],
      Notification.types[:mentioned],
      Notification.types[:chat_quoted],
    ].include?(type)
   if existing_notifications.find { |n| n.notification_type == Notification.types[:replied] }
     return
   end
 end

 To:
 # linked, quoted, mentioned, chat_quoted may be suppressed if you already have any notification about this 
 post
 if [
      Notification.types[:quoted],
      Notification.types[:linked],
      Notification.types[:mentioned],
      Notification.types[:chat_quoted],
    ].include?(type)
   return if existing_notifications.any?
 end

This will work but I do worry a bit cause there are other notifications that can slip through here. (plugins notifications for example that are ones we may want to suppress)

@lindsey there is a bit of a product question here, when should we suppress a notification?

I guess the small fix is a step forward?