notifications: Complete old compatibility TODO.

We no longer support upgrading from old enough versions that bots
should get here, which means we can move to the more compact assert
statement.
This commit is contained in:
Tim Abbott
2025-03-25 13:48:39 -07:00
parent 852b957da8
commit f3a829ce71
2 changed files with 5 additions and 19 deletions

View File

@@ -613,14 +613,9 @@ def handle_missedmessage_emails(
user_profile_id: int, message_ids: dict[int, MissedMessageData] user_profile_id: int, message_ids: dict[int, MissedMessageData]
) -> None: ) -> None:
user_profile = get_user_profile_by_id(user_profile_id) user_profile = get_user_profile_by_id(user_profile_id)
if user_profile.is_bot: # nocoverage # Bots don't have real email addresses, and should have been
# We don't expect to reach here for bot users. However, this code exists # filtered previously.
# to find and throw away any pre-existing events in the queue while assert not user_profile.is_bot
# upgrading from versions before our notifiability logic was implemented.
# TODO/compatibility: This block can be removed when one can no longer
# upgrade from versions <= 4.0 to versions >= 5.0
logger.warning("Send-email event found for bot user %s. Skipping.", user_profile_id)
return
if not user_profile.enable_offline_email_notifications: if not user_profile.enable_offline_email_notifications:
# BUG: Investigate why it's possible to get here. # BUG: Investigate why it's possible to get here.

View File

@@ -1277,18 +1277,9 @@ def handle_push_notification(user_profile_id: int, missed_message: dict[str, Any
""" """
if not push_notifications_configured(): if not push_notifications_configured():
return return
user_profile = get_user_profile_by_id(user_profile_id)
if user_profile.is_bot: # nocoverage user_profile = get_user_profile_by_id(user_profile_id)
# We don't expect to reach here for bot users. However, this code exists assert not user_profile.is_bot
# to find and throw away any pre-existing events in the queue while
# upgrading from versions before our notifiability logic was implemented.
# TODO/compatibility: This block can be removed when one can no longer
# upgrade from versions <= 4.0 to versions >= 5.0
logger.warning(
"Send-push-notification event found for bot user %s. Skipping.", user_profile_id
)
return
if not ( if not (
user_profile.enable_offline_push_notifications user_profile.enable_offline_push_notifications