Skip to content

Commit fa81750

Browse files
chrisbobbegnprice
authored andcommitted
msglist: Exclude muted users from typing-status text
Following web: #1429 (review)
1 parent 3bffc93 commit fa81750

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
@@ -1195,12 +1195,15 @@ class _TypingStatusWidgetState extends State<TypingStatusWidget> with PerAccount
11951195
final zulipLocalizations = ZulipLocalizations.of(context);
11961196
final typistIds = model!.typistIdsInNarrow(narrow);
11971197
if (typistIds == null) return const SizedBox();
1198-
final text = switch (typistIds.length) {
1198+
final filteredTypistIds = typistIds
1199+
.whereNot((userId) => store.isUserMuted(userId));
1200+
if (filteredTypistIds.isEmpty) return const SizedBox();
1201+
final text = switch (filteredTypistIds.length) {
11991202
1 => zulipLocalizations.onePersonTyping(
1200-
store.userDisplayName(typistIds.first)),
1203+
store.userDisplayName(filteredTypistIds.first)),
12011204
2 => zulipLocalizations.twoPeopleTyping(
1202-
store.userDisplayName(typistIds.first),
1203-
store.userDisplayName(typistIds.last)),
1205+
store.userDisplayName(filteredTypistIds.first),
1206+
store.userDisplayName(filteredTypistIds.last)),
12041207
_ => zulipLocalizations.manyPeopleTyping,
12051208
};
12061209

test/widgets/message_list_test.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,9 +833,19 @@ void main() {
833833
await checkTyping(tester,
834834
eg.typingEvent(narrow, TypingOp.stop, eg.otherUser.userId),
835835
expected: 'Third User and Fourth User are typing…');
836+
await store.setMutedUsers([eg.thirdUser.userId]);
837+
await tester.pump();
838+
check(tester.widget<Text>(finder)).data.equals('Fourth User is typing…');
836839
// Verify that typing indicators expire after a set duration.
837840
await tester.pump(const Duration(seconds: 15));
838841
check(finder.evaluate()).isEmpty();
842+
// Muted user starts typing again; nothing is shown.
843+
await store.handleEvent(
844+
eg.typingEvent(narrow, TypingOp.start, eg.thirdUser.userId));
845+
await tester.pump();
846+
check(finder.evaluate()).isEmpty();
847+
await tester.pump(const Duration(seconds: 15));
848+
check(finder.evaluate()).isEmpty();
839849
});
840850
}
841851

0 commit comments

Comments
 (0)