From 3675a44471d919c7f6d2fb025dd97781154c8654 Mon Sep 17 00:00:00 2001 From: Prakhar Pratyush Date: Tue, 8 Aug 2023 22:59:33 +0530 Subject: [PATCH] push_notifications: Add the missing compatibility code. This commit adds 'TODO/compatibility' code to support the old notification trigger values in the push notification queue during the Zulip server upgrades. In f4fa82e, we renamed the following notification triggers: * 'wildcard_mentioned' to 'stream_wildcard_mentioned' * 'followed_topic_wildcard_mentioned' to 'stream_wildcard_mentioned_in_followed_topic'. This should have been added in f4fa82e. --- zerver/lib/push_notifications.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/zerver/lib/push_notifications.py b/zerver/lib/push_notifications.py index 4f0c3589b4..2c818dd02d 100644 --- a/zerver/lib/push_notifications.py +++ b/zerver/lib/push_notifications.py @@ -1123,6 +1123,19 @@ def handle_push_notification(user_profile_id: int, missed_message: Dict[str, Any return trigger = missed_message["trigger"] + + # TODO/compatibility: Translation code for the rename of + # `wildcard_mentioned` to `stream_wildcard_mentioned`. + # Remove this when one can no longer directly upgrade from 7.x to main. + if trigger == "wildcard_mentioned": + trigger = NotificationTriggers.STREAM_WILDCARD_MENTION # nocoverage + + # TODO/compatibility: Translation code for the rename of + # `followed_topic_wildcard_mentioned` to `stream_wildcard_mentioned_in_followed_topic`. + # Remove this when one can no longer directly upgrade from 7.x to main. + if trigger == "followed_topic_wildcard_mentioned": + trigger = NotificationTriggers.STREAM_WILDCARD_MENTION_IN_FOLLOWED_TOPIC # nocoverage + mentioned_user_group_name = None # mentioned_user_group_id will be None if the user is personally mentioned # regardless whether they are a member of the mentioned user group in the