@@ -668,7 +668,10 @@ class MessageListView with ChangeNotifier, _MessageSequence {
668668 /// This depends in particular on whether the message is muted in
669669 /// one way or another.
670670 ///
671- /// See also [_allMessagesVisible] .
671+ /// See also:
672+ /// - [_allMessagesVisible] , message-fetch optimization related to this
673+ /// - Message-list UI that mitigates spam/harrassment
674+ /// by obscuring messages from muted senders, with a "reveal" button
672675 bool _messageVisible (MessageBase message) {
673676 switch (narrow) {
674677 case CombinedFeedNarrow ():
@@ -694,7 +697,23 @@ class MessageListView with ChangeNotifier, _MessageSequence {
694697 // If changing this, consider whether [Unreads.countInMentionsNarrow]
695698 // should be changed correspondingly, so the message-list view matches
696699 // the unread-count badge.
700+ if (message.conversation case DmConversation (: final allRecipientIds)) {
701+ return ! store.shouldMuteDmConversation (DmNarrow (
702+ allRecipientIds: allRecipientIds, selfUserId: store.selfUserId));
703+ }
704+ return true ;
705+
697706 case StarredMessagesNarrow ():
707+ // Include messages even if muted in some way.
708+ // Other users can't spam the starred-messages view by starring;
709+ // the starred state is read/write by the self-user only.
710+ //
711+ // If we want to change this, consider that we need to compute a
712+ // starred-message count without relying on fetched message data:
713+ // https://zulip.com/help/star-a-message#view-your-starred-messages
714+ // ([MessageStore.starredMessages] is just a list of message IDs.)
715+ return true ;
716+
698717 case KeywordSearchNarrow ():
699718 if (message.conversation case DmConversation (: final allRecipientIds)) {
700719 return ! store.shouldMuteDmConversation (DmNarrow (
@@ -718,7 +737,11 @@ class MessageListView with ChangeNotifier, _MessageSequence {
718737 return true ;
719738
720739 case MentionsNarrow ():
740+ return false ;
741+
721742 case StarredMessagesNarrow ():
743+ return true ;
744+
722745 case KeywordSearchNarrow ():
723746 return false ;
724747 }
@@ -757,7 +780,11 @@ class MessageListView with ChangeNotifier, _MessageSequence {
757780 return MutedUsersVisibilityEffect .none;
758781
759782 case MentionsNarrow ():
783+ return store.mightChangeShouldMuteDmConversation (event);
784+
760785 case StarredMessagesNarrow ():
786+ return MutedUsersVisibilityEffect .none;
787+
761788 case KeywordSearchNarrow ():
762789 return store.mightChangeShouldMuteDmConversation (event);
763790 }
0 commit comments