# Watching a category does not cause push notifications

**URL:** https://meta.discourse.org/t/watching-a-category-does-not-cause-push-notifications/282794
**Category:** Bug
**Created:** [October 19, 2023, 1:27pm UTC](https://meta.discourse.org/t/watching-a-category-does-not-cause-push-notifications/282794 "2023-10-19T13:27:33Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [October 19, 2023, 1:27pm UTC](https://meta.discourse.org/t/watching-a-category-does-not-cause-push-notifications/282794/1 "2023-10-19T13:27:33Z")

</div>

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](https://github.com/discourse/discourse/blame/main/app/services/post_alerter.rb#L633) and I find a condition `NOTIFIABLE_TYPES.include?(type)`

`NOTIFIABLE_TYPES` does [include](https://github.com/discourse/discourse/blame/main/app/services/post_alerter.rb#L385-L397) `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](https://meta.discourse.org/t/watching-first-post-does-not-send-push-notifications/105124) and [this](https://github.com/discourse/discourse/commit/aa3a9b6fea9190eadd4e0152f1b8e26cee3de0be) 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 😉

---

<div class="post-metadata">

### Author: ![markvanlan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/markvanlan/32/160087_2.png) [@markvanlan](https://meta.discourse.org/u/markvanlan)
#### Post date: [November 1, 2023, 3:07pm UTC](https://meta.discourse.org/t/watching-a-category-does-not-cause-push-notifications/282794/6 "2023-11-01T15:07:57Z")

</div>

I’ve merged [a commit](https://github.com/discourse/discourse/commit/88874389d2d80e638954e28c4f4145e7a3cdd105) that adds `watching_category_or_tag` to `NOTIFIABLE_TYPES` just like you outlined! Thanks for the bug report and solution :chefs_kiss:

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [November 1, 2023, 8:19pm UTC](https://meta.discourse.org/t/watching-a-category-does-not-cause-push-notifications/282794/8 "2023-11-01T20:19:52Z")

</div>

Thanks @markvanlan !!

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

---

<div class="post-metadata">

### Author: ![markvanlan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/markvanlan/32/160087_2.png) [@markvanlan](https://meta.discourse.org/u/markvanlan)
#### Post date: [November 1, 2023, 8:35pm UTC](https://meta.discourse.org/t/watching-a-category-does-not-cause-push-notifications/282794/9 "2023-11-01T20:35:24Z")

</div>

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.

```plaintext
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](https://github.com/discourse/discourse/commit/1d96b0a99adb0c2236c90fc4fa949734451f9351)

---

<div class="post-metadata">

### Author: ![markvanlan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/markvanlan/32/160087_2.png) [@markvanlan](https://meta.discourse.org/u/markvanlan)
#### Post date: [November 6, 2023, 4:17pm UTC](https://meta.discourse.org/t/watching-a-category-does-not-cause-push-notifications/282794/10 "2023-11-06T16:17:35Z")

</div>

I just pushed [another commit](https://github.com/discourse/discourse/commit/047cae4b3f316b5018efaab552ef1762f4bbdd37) 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!

---

<div class="post-metadata">

### Author: ![nat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nat/32/235063_2.png) [@nat](https://meta.discourse.org/u/nat)
#### Post date: [November 8, 2023, 12:00am UTC](https://meta.discourse.org/t/watching-a-category-does-not-cause-push-notifications/282794/11 "2023-11-08T00:00:37Z")

</div>

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