A platform for community discussion. Free, open, simple.
DEV: Move DiscourseEvent trigger in PostAlerter#push_notification (#25931)
Mark VanLandingham0a58b1897098
diff --git a/app/services/post_alerter.rb b/app/services/post_alerter.rbindex 08b833e90ed..a1755ad3b6d 100644--- a/app/services/post_alerter.rb+++ b/app/services/post_alerter.rb@@ -57,6 +57,11 @@ class PostAlerterdef self.push_notification(user, payload)return if user.do_not_disturb?+ # This DiscourseEvent needs to be independent of the push_notification_filters for some use cases.+ # If the subscriber of this event wants to filter usage by push_notification_filters as well,+ # implement same logic as below (`if DiscoursePluginRegistry.push_notification_filters.any?...`)+ DiscourseEvent.trigger(:push_notification, user, payload)+if DiscoursePluginRegistry.push_notification_filters.any? { |filter|!filter.call(user, payload)}@@ -90,8 +95,6 @@ class PostAlerterJobs.enqueue(:push_notification, clients: clients, payload: payload, user_id: user.id)endend-- DiscourseEvent.trigger(:push_notification, user, payload)enddef initialize(default_opts = {})