process_message_event: Always calculate `online_push_enabled`.

Unlike `receiver_is_off_zulip`, fetching from a dict is pretty cheap,
so we can calculate `online_push_enabled` along with the other
variables.

This is a prep change to start using the dataclass introduced in the
earlier commit in this code.
This commit is contained in:
Abhijeet Prasad Bodas 2021-06-11 18:11:40 +05:30 committed by Tim Abbott
parent 951b49c048
commit 3ff3ded1ae
1 changed files with 10 additions and 10 deletions

View File

@ -952,6 +952,16 @@ def process_message_event(
wildcard_mention_notify = user_data.get("wildcard_mention_notify", False)
sender_is_muted = user_data.get("sender_is_muted", False)
# TODO/compatibility: Translation code for the rename of
# `always_push_notify` to `online_push_enabled`. Remove this
# when one can no longer directly upgrade from 4.x to master.
if "online_push_enabled" in user_data:
online_push_enabled = user_data["online_push_enabled"]
elif "always_push_notify" in user_data:
online_push_enabled = user_data["always_push_notify"]
else:
online_push_enabled = False
extra_user_data[user_profile_id] = dict(
internal_data=dict(
mentioned=mentioned,
@ -979,16 +989,6 @@ def process_message_event(
user_profile_id in presence_idle_user_ids
)
# TODO/compatibility: Translation code for the rename of
# `always_push_notify` to `online_push_enabled`. Remove this
# when one can no longer directly upgrade from 4.x to master.
if "online_push_enabled" in user_data:
online_push_enabled = user_data["online_push_enabled"]
elif "always_push_notify" in user_data:
online_push_enabled = user_data["always_push_notify"]
else:
online_push_enabled = False
stream_name = event_template.get("stream_name")
extra_user_data[user_profile_id]["internal_data"].update(