Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
event_queue: Don't check for "read" flag when processing events.
Abhijeet Prasad Bodas10dd5f784bd4
diff --git a/zerver/tests/test_event_queue.py b/zerver/tests/test_event_queue.pyindex 91f8bf1d4dc..e3333d8ca08 100644--- a/zerver/tests/test_event_queue.py+++ b/zerver/tests/test_event_queue.py@@ -351,30 +351,6 @@ class MissedMessageNotificationsTest(ZulipTestCase):)destroy_event_queue(client_descriptor.event_queue.id)- # Test the hook with a wildcard mention sent by the user- # themself using a human client; should not notify.- client_descriptor = allocate_event_queue()- self.assertTrue(client_descriptor.event_queue.empty())- msg_id = self.send_stream_message(- self.example_user("hamlet"),- "Denmark",- content="@**all** what's up?",- sending_client_name="website",- )- with mock.patch("zerver.tornado.event_queue.maybe_enqueue_notifications") as mock_enqueue:- missedmessage_hook(user_profile.id, client_descriptor, True)- mock_enqueue.assert_called_once()- args_list = mock_enqueue.call_args_list[0][0]-- assert_maybe_enqueue_notifications_call_args(- args_list=args_list,- user_profile_id=user_profile.id,- message_id=msg_id,- stream_name="Denmark",- already_notified={"email_notified": False, "push_notified": False},- )- destroy_event_queue(client_descriptor.event_queue.id)-# Wildcard mentions in muted streams don't notify.change_subscription_properties(user_profile, stream, sub, {"is_muted": True})client_descriptor = allocate_event_queue()diff --git a/zerver/tornado/event_queue.py b/zerver/tornado/event_queue.pyindex 59474e0c177..8e299628719 100644--- a/zerver/tornado/event_queue.py+++ b/zerver/tornado/event_queue.py@@ -740,15 +740,13 @@ def missedmessage_hook(flags = event["flags"]- mentioned = "mentioned" in flags and "read" not in flags+ mentioned = "mentioned" in flagsprivate_message = event["message"]["type"] == "private"# stream_push_notify is set in process_message_event.stream_push_notify = internal_data.get("stream_push_notify", False)stream_email_notify = internal_data.get("stream_email_notify", False)wildcard_mention_notify = (- internal_data.get("wildcard_mention_notify", False)- and "read" not in flags- and "wildcard_mentioned" in flags+ internal_data.get("wildcard_mention_notify", False) and "wildcard_mentioned" in flags)stream_name = None@@ -949,13 +947,11 @@ def process_message_event(# If the recipient was offline and the message was a single or group PM to them# or they were @-notified potentially notify more immediatelyprivate_message = message_type == "private" and user_profile_id != sender_id- mentioned = "mentioned" in flags and "read" not in flags+ mentioned = "mentioned" in flagsstream_push_notify = user_data.get("stream_push_notify", False)stream_email_notify = user_data.get("stream_email_notify", False)wildcard_mention_notify = (- user_data.get("wildcard_mention_notify", False)- and "wildcard_mentioned" in flags- and "read" not in flags+ user_data.get("wildcard_mention_notify", False) and "wildcard_mentioned" in flags)sender_is_muted = user_data.get("sender_is_muted", False)