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."
This commit is contained in:
Alex Vandiver 2024-05-23 17:25:30 +00:00 committed by Tim Abbott
parent e73e44402a
commit cb2a105de2
1 changed files with 2 additions and 1 deletions

View File

@ -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,