Watching a category does not cause push notifications

So when I have a category set to “watching first post” (“You will be notified of the first post in each new topic in these categories.”) I get push notifications on my phone when a topic is created in a category, and I get push notifications for subsequent replies too.

But when I have the category set to “watching” (“You will be notified of all new posts and topics”) I do not get push notifications.

Checking the code and I find a condition NOTIFIABLE_TYPES.include?(type)

NOTIFIABLE_TYPES does include watching_first_post and posted but it does not include watching_category_or_tag.

Is this intentional? I’ve always thought that watching was a superset of watching first post?

(Similar/related: Watching First Post does not send push notifications and this change)

EDIT I am currently running a few forums I’m using myself with a patched version that adds watching_category_or_tag and with push notification time window mins set to 0 my user experience went from ‘meh’ to ‘great’. So if this is not a bug, consider it a feature request :wink:

8 Likes

I’ve merged a commit that adds watching_category_or_tag to NOTIFIABLE_TYPES just like you outlined! Thanks for the bug report and solution :chefs_kiss:

7 Likes

Thanks @markvanlan !!

… I just found out that this also requires a locale string en.discourse_push_notifications.popup.watching_category_or_tag

1 Like

Oh nice catch, of course the type is tied to a translation! But… I’m curious the best text. The one for watching_first_post is below. I wonder if the translation should be X created a new post, rather than X created a new topic, since it could be a new topic but more likely is a reply.

To get more fancy with the string we will have to modify PushNotificationPusher. For now I’ll create a PR to implement my suggestion and we can follow up with an improvment.

watching_first_post: '%{username} created a new topic "%{topic}" - %{site_title}'
watching_category_or_tag: '%{username} created a new post "%{topic}" - %{site_title}'

EDIT: Added a commit with translation. I’m going to follow up tomorrow and see about giving a more rich experience that links directly to the post, with a note about what category or tag is associated with it. FIX: Add translation for new push notification (#24203) · discourse/discourse@1d96b0a · GitHub

4 Likes

I just pushed another commit that improves the push notification text a bit. From PR description:

Now for new topics it’ll read:

username created a new topic "title here!" - Marks' Discourse

And for new posts:

username posted in "title here!" - Marks' Discourse


After digging into the code it would be a huge change to have the text read something like: “X posted a new topic in Y category/tag”. This is a good step in the right direction and we can follow up with a much more complex change if it’s required in the future.

Thanks again @RGJ!

3 Likes

This topic was automatically closed after 13 hours. New replies are no longer allowed.