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.
This commit is contained in:
Prakhar Pratyush 2023-08-08 22:59:33 +05:30 committed by Tim Abbott
parent 0e23280b4f
commit 3675a44471
1 changed files with 13 additions and 0 deletions

View File

@ -1123,6 +1123,19 @@ def handle_push_notification(user_profile_id: int, missed_message: Dict[str, Any
return return
trigger = missed_message["trigger"] 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_name = None
# mentioned_user_group_id will be None if the user is personally mentioned # 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 # regardless whether they are a member of the mentioned user group in the