mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 11:22:04 +00:00
notification_data: Add methods to determine notifiability.
We will later consistently use these functions to check for notifiable messages in the message send and event_queue code. We have these functions accept the `sender_id` so that we can avoid the `private_message = message["type"] == "private" and user_id != sender_id` wizardy.
This commit is contained in:
committed by
Tim Abbott
parent
ed58393079
commit
8182632d7e
@@ -55,6 +55,7 @@ from zerver.lib.actions import (
|
||||
)
|
||||
from zerver.lib.cache import bounce_key_prefix_for_testing
|
||||
from zerver.lib.initial_password import initial_password
|
||||
from zerver.lib.notification_data import UserMessageNotificationsData
|
||||
from zerver.lib.rate_limiter import bounce_redis_key_prefix_for_testing
|
||||
from zerver.lib.sessions import get_session_dict_user
|
||||
from zerver.lib.stream_subscription import get_stream_subscriptions_for_user
|
||||
@@ -1322,6 +1323,18 @@ Output:
|
||||
|
||||
self.assert_length(lst, expected_num_events)
|
||||
|
||||
def create_user_notifications_data_object(self, **kwargs: Any) -> UserMessageNotificationsData:
|
||||
return UserMessageNotificationsData(
|
||||
id=kwargs.get("id", self.example_user("hamlet").id),
|
||||
flags=kwargs.get("flags", []),
|
||||
mentioned=kwargs.get("mentioned", False),
|
||||
online_push_enabled=kwargs.get("online_push_enabled", False),
|
||||
stream_email_notify=kwargs.get("stream_email_notify", False),
|
||||
stream_push_notify=kwargs.get("stream_push_notify", False),
|
||||
wildcard_mention_notify=kwargs.get("wildcard_mention_notify", False),
|
||||
sender_is_muted=kwargs.get("sender_is_muted", False),
|
||||
)
|
||||
|
||||
def get_maybe_enqueue_notifications_parameters(self, **kwargs: Any) -> Dict[str, Any]:
|
||||
"""
|
||||
Returns a dictionary with the passed parameters, after filling up the
|
||||
|
||||
Reference in New Issue
Block a user