mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
email_notification: Include prior message context only when mentioned.
Earlier, email message notifications included prior messages sent to the same topic for context. This is more confusing than helpful for messages that the user is likely to have received notifications for all the prior messages in the conversation already (or read them in the Zulip UI). Now, we include prior context only when the user is mentioned via personal, group, stream or topic wildcard mention. Fixes #27479.
This commit is contained in:
committed by
Tim Abbott
parent
c0f445294c
commit
94679d590f
@@ -3662,6 +3662,20 @@ class UserMessage(AbstractUserMessage):
|
||||
"""
|
||||
return UserMessage.objects.select_for_update().order_by("message_id")
|
||||
|
||||
@staticmethod
|
||||
def has_any_mentions(user_profile_id: int, message_id: int) -> bool:
|
||||
# The query uses the 'zerver_usermessage_any_mentioned_message_id' index.
|
||||
return UserMessage.objects.filter(
|
||||
Q(
|
||||
flags__andnz=UserMessage.flags.mentioned.mask
|
||||
| UserMessage.flags.wildcard_mentioned.mask
|
||||
| UserMessage.flags.topic_wildcard_mentioned.mask
|
||||
| UserMessage.flags.group_mentioned.mask
|
||||
),
|
||||
user_profile_id=user_profile_id,
|
||||
message_id=message_id,
|
||||
).exists()
|
||||
|
||||
|
||||
def get_usermessage_by_message_id(
|
||||
user_profile: UserProfile, message_id: int
|
||||
|
||||
Reference in New Issue
Block a user