message_move: Mark notification messages as read for acting user.

When moving messages, the notification messages should be
automatically marked as read for the user who moved the messages.
This commit is contained in:
Vector73
2025-08-05 08:10:13 +00:00
committed by Tim Abbott
parent 4b822d19cf
commit f689dfc3c3
3 changed files with 97 additions and 1 deletions

View File

@@ -285,6 +285,7 @@ def maybe_send_resolve_topic_notifications(
),
message_type=Message.MessageType.RESOLVE_TOPIC_NOTIFICATION,
limit_unread_user_ids=unread_user_ids,
mark_as_read_for_acting_user=True,
acting_user=user_profile,
)
@@ -353,6 +354,7 @@ def send_message_moved_breadcrumbs(
user=user_mention,
changed_messages_count=changed_messages_count,
),
mark_as_read_for_acting_user=True,
acting_user=user_profile,
)
@@ -368,6 +370,7 @@ def send_message_moved_breadcrumbs(
new_location=new_topic_link,
changed_messages_count=changed_messages_count,
),
mark_as_read_for_acting_user=True,
acting_user=user_profile,
)

View File

@@ -2081,6 +2081,7 @@ def internal_send_stream_message(
email_gateway: bool = False,
message_type: int = Message.MessageType.NORMAL,
limit_unread_user_ids: set[int] | None = None,
mark_as_read_for_acting_user: bool = False,
archived_channel_notice: bool = False,
acting_user: UserProfile | None = None,
) -> int | None:
@@ -2099,7 +2100,11 @@ def internal_send_stream_message(
if message is None:
return None
sent_message_result = do_send_messages([message])[0]
mark_as_read = []
if mark_as_read_for_acting_user and acting_user is not None:
mark_as_read.append(acting_user.id)
sent_message_result = do_send_messages([message], mark_as_read=mark_as_read)[0]
return sent_message_result.message_id