mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
mute user: Add some comments on message fetch.
These explain why we don't consider user mutes in message fetching/unread data.
This commit is contained in:
committed by
Tim Abbott
parent
8b098b95bb
commit
2b9f2cc8ff
@@ -1010,6 +1010,9 @@ def extract_unread_data_from_um_rows(
|
||||
if topic_mute_checker(recipient_id, topic):
|
||||
return True
|
||||
|
||||
# Messages sent by muted users are never unread, so we don't
|
||||
# need any logic related to muted users here.
|
||||
|
||||
return False
|
||||
|
||||
huddle_cache: Dict[int, str] = {}
|
||||
|
||||
@@ -736,6 +736,9 @@ def exclude_muting_conditions(
|
||||
except Stream.DoesNotExist:
|
||||
pass
|
||||
|
||||
# Stream-level muting only applies when looking at views that
|
||||
# include multiple streams, since we do want users to be able to
|
||||
# browser messages within a muted stream.
|
||||
if stream_id is None:
|
||||
rows = Subscription.objects.filter(
|
||||
user_profile=user_profile,
|
||||
@@ -751,6 +754,15 @@ def exclude_muting_conditions(
|
||||
|
||||
conditions = exclude_topic_mutes(conditions, user_profile, stream_id)
|
||||
|
||||
# Muted user logic for hiding messages is implemented entirely
|
||||
# client-side. This is by design, as it allows UI to hint that
|
||||
# muted messages exist where their absence might make conversation
|
||||
# difficult to understand. As a result, we do not need to consider
|
||||
# muted users in this server-side logic for returning messages to
|
||||
# clients. (We could in theory exclude PMs from muted users, but
|
||||
# they're likely to be sufficiently rare to not be worth extra
|
||||
# logic/testing here).
|
||||
|
||||
return conditions
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user