Notifications being regenerated by looking through actions

AI-generated summary

A user is experiencing duplicate notifications on their Discourse forum, with notifications being regenerated days after the initial event. RGJ suspects that this is related to browsing through user actions, specifically replies, as the notification for a post was regenerated immediately after the user browsed through their replies. The issue may be connected to the follow plugin, as a similar bug was previously fixed. RGJ references a previous topic on meta.discourse.org, where a user’s follow status was causing recurrent notifications. codinghorror suggests that this may be another instance of the follow plugin bug, but RGJ is unsure, citing some differences in the issue.

Ok, this is a weird story on an older version but I was hoping that someone would have some pointers or maybe a similar experience.

We have a forum (on 2.4.5 because of a bespoke plugin dependency) where people complain about duplicate notifications. Sometimes notifications are regenerated days after an event happened and after a user has seen (and clicked on) those notifications multiple times - in the Discourse UI (not in the app, not in the browser).

posts for a topic:

 post_number |         created_at         
-------------+----------------------------
           1 | 2020-06-22 17:06:42.531868
           2 | 2020-06-23 00:11:07.159579
           3 | 2020-06-24 00:35:06.000641
           4 | 2020-06-25 00:17:16.998622
           5 | 2020-06-29 00:00:39.712988
           6 | 2020-06-29 01:03:20.137653
           7 | 2020-06-29 01:32:45.604947

notifications for this user for this topic:

   id    | notification_type | user_id |         created_at         | topic_id | post_number 
---------+-------------------+---------+----------------------------+----------+-------------
 1125345 |                 5 |     956 | 2020-06-24 21:45:21.521173 |    39247 |           3
 1133280 |                 5 |     956 | 2020-06-29 01:27:32.242212 |    39247 |           6
 1140349 |                 2 |     956 | 2020-07-02 21:11:44.843782 |    39247 |           7

As you can see, a reply notification was generated for post #7 over 3.5 days after the reply was made.

When grepping through the access logs to find out what happened at 21:11:44 we saw that this user was browsing through their Profile - Activity - Replies (/user_actions.json?username=redacted&filter=5&offset=240) at that exact second.

It almost seems like browsing through those replies regenerated the notification.

Relevant plugins are onesignal and push-notifications.

Does anyone have ANY idea?

EDIT a day later the notification for post #7 has been regenerated:

   id    | notification_type | user_id |         created_at         | topic_id | post_number 
---------+-------------------+---------+----------------------------+----------+-------------
 1125345 |                 5 |     956 | 2020-06-24 21:45:21.521173 |    39247 |           3
 1133280 |                 5 |     956 | 2020-06-29 01:27:32.242212 |    39247 |           6
 1141684 |                 2 |     956 | 2020-07-04 02:23:12.188685 |    39247 |           7

This sounds vaguely familiar to me as a bug we fixed at some point? Hard to say.

Hmm, relevant plugins are onesignal and push-notifications and follow.

@outofthebox I think this is related

The user that created the post (user #15356) that generates the notification to the user repeatedly receiving the notification (user #956) is:

  • following the user receiving the notification
  • followed by a user that does not exist (user #16229)

:

 select user_id, name, value from user_custom_fields where user_id=15356;
 user_id |     name     |         value          
---------+--------------+------------------------
   15356 | followers    | 16229 --> this user does not exist
   15356 | following    | 56,0
   15356 | following    | 956,0 --> the user receiving the notification

So this is another instance of the follow plugin bug?

I’m not sure (yet), it seems a little different, but OTOH there is much in common.