Only showing most recent notification from a watched topic?

AI-generated summary

The discussion revolves around the behavior of notifications in a watched topic on Discourse. tophee noticed that a notification from a user named merefield disappeared after receiving a new notification, even though it was visible earlier. david investigated and confirmed that the notification was missing from the database. tophee later confirmed that the issue persisted. david explained that this is expected behavior: when watching a topic, only the most recent notification is retained to prevent an overload of notifications, and older ones are deleted. This deletion occurs in the web UI, not in the Android app, which is why the notification was still visible there. The behavior is governed by code in the post_alerter.rb file, which limits notifications to the most recent one per topic.

Not that small, I would say :wink: but no, the notification was there, it was published whenever you posted your reply and I saw it via the discourse Android app. Unfortunately, the app doesn’t take you to the post when you tap the android notification so I navigated to meta, tapped my avatar and tapped the notification about your reply. That’s how I got here. But now it’s no longer there:

Wait, there is a pattern here. The above screenshot was taken when I composed my previous reply. Here is what it looks like now:

Notice how I now have the notification for your last reply but the one from merefield is also gone now?

2 Likes

Something fishy is definitely going on here… the notification from merefield seems to be missing from the database as well :thinking:

[5] pry(main)> User.find_by_username("tophee").notifications.order(created_at: :desc).limit(10).pluck(:data).map { |d| JSON.parse(d) }.map {|j| j["display_username"] }
=> ["david", "david", "david", "david", "codinghorror", "zogstrip", "gpetrov", "SidV", "jomaxro", "sam"]

Now that you have a fresh notification, has anything changed @tophee?

2 Likes

This is what it looks like now:

So nothing new went missing (possibly because of the new topic).

1 Like

Oh, this is expected behaviour, I just never noticed it before. If you’re watching a topic, we don’t want you to end up with millions of notifications about a single topic, so we only keep the ‘most recent’ notification.

So after you received the android notification, merefield replied and caused the other notification to be deleted. We don’t delete the notification from Android, only from the web UI.

6 Likes

This topic was automatically closed after 18 minutes. New replies are no longer allowed.