Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

mute user: Add some comments on message fetch.

Abhijeet Prasad Bodas2b9f2cc8ff59
diff --git a/zerver/lib/message.py b/zerver/lib/message.py
index e0626424363..60d7d1367cc 100644
--- a/zerver/lib/message.py
+++ b/zerver/lib/message.py
@@ -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] = {}
diff --git a/zerver/views/message_fetch.py b/zerver/views/message_fetch.py
index f50f4465913..566c1755885 100644
--- a/zerver/views/message_fetch.py
+++ b/zerver/views/message_fetch.py
@@ -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