Skip to content

Commit c40cb89

Browse files
committed
msglist: Exclude muted users from typing-status text
Following web: zulip#1429 (review)
1 parent 87df780 commit c40cb89

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

lib/widgets/message_list.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -947,12 +947,15 @@ class _TypingStatusWidgetState extends State<TypingStatusWidget> with PerAccount
947947
final zulipLocalizations = ZulipLocalizations.of(context);
948948
final typistIds = model!.typistIdsInNarrow(narrow);
949949
if (typistIds == null) return const SizedBox();
950-
final text = switch (typistIds.length) {
950+
final filteredTypistIds = typistIds
951+
.whereNot((userId) => store.isUserMuted(userId));
952+
if (filteredTypistIds.isEmpty) return const SizedBox();
953+
final text = switch (filteredTypistIds.length) {
951954
1 => zulipLocalizations.onePersonTyping(
952-
store.userDisplayName(typistIds.first)),
955+
store.userDisplayName(filteredTypistIds.first)),
953956
2 => zulipLocalizations.twoPeopleTyping(
954-
store.userDisplayName(typistIds.first),
955-
store.userDisplayName(typistIds.last)),
957+
store.userDisplayName(filteredTypistIds.first),
958+
store.userDisplayName(filteredTypistIds.last)),
956959
_ => zulipLocalizations.manyPeopleTyping,
957960
};
958961

test/widgets/message_list_test.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,9 +756,19 @@ void main() {
756756
await checkTyping(tester,
757757
eg.typingEvent(narrow, TypingOp.stop, eg.otherUser.userId),
758758
expected: 'Third User and Fourth User are typing…');
759+
await store.setMutedUsers([eg.thirdUser.userId]);
760+
await tester.pump();
761+
check(tester.widget<Text>(finder)).data.equals('Fourth User is typing…');
759762
// Verify that typing indicators expire after a set duration.
760763
await tester.pump(const Duration(seconds: 15));
761764
check(finder.evaluate()).isEmpty();
765+
// Muted user starts typing again; nothing is shown.
766+
await store.handleEvent(
767+
eg.typingEvent(narrow, TypingOp.start, eg.thirdUser.userId));
768+
await tester.pump();
769+
check(finder.evaluate()).isEmpty();
770+
await tester.pump(const Duration(seconds: 15));
771+
check(finder.evaluate()).isEmpty();
762772
});
763773
}
764774

0 commit comments

Comments
 (0)