DEV: Add :push_notification event and deprecate :post_notification_alert (#22917)

This commit introduces the :push_notification event and deprecates :post_notification_alert.

The old :post_notification_alert event was not triggered when pushing chat notifications and did not respect when the user was in "do not disturb" mode.

The new event fixes these issues.
This commit is contained in:
Sérgio Saquetim
2023-08-02 18:44:19 -03:00
committed by GitHub
parent f9b4cfe67e
commit 03690ccccf
3 changed files with 40 additions and 2 deletions

View File

@ -13,13 +13,23 @@ class DiscourseEvent
end
def self.on(event_name, &block)
if event_name == :user_badge_removed
case event_name
when :user_badge_removed
Discourse.deprecate(
"The :user_badge_removed event is deprecated. Please use :user_badge_revoked instead",
since: "3.1.0.beta5",
drop_from: "3.2.0.beta1",
output_in_test: true,
)
when :post_notification_alert
Discourse.deprecate(
"The :post_notification_alert event is deprecated. Please use :push_notification instead",
since: "3.2.0.beta1",
drop_from: "3.3.0.beta1",
output_in_test: true,
)
else
# ignore
end
events[event_name] << block