# PostAlerter after\_save\_post behaviour

**URL:** <https://meta.discourse.org/t/postalerter-after-save-post-behaviour/140537>\
**Category:** Development\
**Created:** [February 4, 2020, 4:14am UTC](https://meta.discourse.org/t/postalerter-after-save-post-behaviour/140537 "2020-02-04T04:14:28Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)\
**Post date:** [February 4, 2020, 4:14am UTC](https://meta.discourse.org/t/postalerter-after-save-post-behaviour/140537/1 "2020-02-04T04:14:28Z")

</div>

The [PostAlerter](https://github.com/discourse/discourse/blob/master/app/services/post_alerter.rb) contains a system of checks and triggers for notifications sent after a regular post is saved, starting with the [after\_save\_post](https://github.com/discourse/discourse/blob/master/app/services/post_alerter.rb#L51) method.

I’ve been tangling with that method for the [Follow Plugin](https://github.com/paviliondev/discourse-follow) (Specifically see [discourse-follow/plugin.rb at main · discourse/discourse-follow · GitHub](https://github.com/paviliondev/discourse-follow/blob/master/plugin.rb#L111)) and have a few thoughts / questions which I’d be interested in others’ thoughts on.

Given the nature of the PostAlerter, I think this discussion goes beyond the Follow Plugin. I can see my suggestions below being relevant to the assign plugin and the polls plugin, amongst others.

My current thinking is along these lines (I’d be happy to make a PR for any of the below):

1. A hook or event trigger in the `after_save_post` method to allow for plugins to add users to send notifications to (or not) within the context of the checks and counters of that method would be great. When sending a notification, three key considerations are:

2. A tweaked use of notification types. Currently there are a few notification type constants used in the PostAlerter which are iterated or filtered in specific checks and counters, e.g. `NOTIFIABLE_TYPES` and `COLLAPSED_NOTIFIABLE_TYPES`.

---

_[View the full topic](https://meta.discourse.org/t/postalerter-after-save-post-behaviour/140537)._
