From cb2a105de26558b5b9527178f9db1cd8c6d71a8f Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Thu, 23 May 2024 17:25:30 +0000 Subject: [PATCH] message: Respect first_visible_message_id when computing unreads. This prevents unread counts for messages which the web UI does not display, and does not let you mark as unread via "mark all as read." --- zerver/lib/message.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zerver/lib/message.py b/zerver/lib/message.py index 5129be17ac..3027d87bb7 100644 --- a/zerver/lib/message.py +++ b/zerver/lib/message.py @@ -579,10 +579,11 @@ def get_raw_unread_data( user_profile: UserProfile, message_ids: Optional[List[int]] = None ) -> RawUnreadMessagesResult: excluded_recipient_ids = get_inactive_recipient_ids(user_profile) - + first_visible_message_id = get_first_visible_message_id(user_profile.realm) user_msgs = ( UserMessage.objects.filter( user_profile=user_profile, + message_id__gte=first_visible_message_id, ) .exclude( message__recipient_id__in=excluded_recipient_ids,