Skip to content

Commit 775ea7a

Browse files
committed
msglist: Exclude muted users from typing-status text
Following web: zulip#1429 (review)
1 parent 459e123 commit 775ea7a

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
@@ -1012,12 +1012,15 @@ class _TypingStatusWidgetState extends State<TypingStatusWidget> with PerAccount
10121012
final zulipLocalizations = ZulipLocalizations.of(context);
10131013
final typistIds = model!.typistIdsInNarrow(narrow);
10141014
if (typistIds == null) return const SizedBox();
1015-
final text = switch (typistIds.length) {
1015+
final filteredTypistIds = typistIds
1016+
.whereNot((userId) => store.isUserMuted(userId));
1017+
if (filteredTypistIds.isEmpty) return const SizedBox();
1018+
final text = switch (filteredTypistIds.length) {
10161019
1 => zulipLocalizations.onePersonTyping(
1017-
store.userDisplayName(typistIds.first)),
1020+
store.userDisplayName(filteredTypistIds.first)),
10181021
2 => zulipLocalizations.twoPeopleTyping(
1019-
store.userDisplayName(typistIds.first),
1020-
store.userDisplayName(typistIds.last)),
1022+
store.userDisplayName(filteredTypistIds.first),
1023+
store.userDisplayName(filteredTypistIds.last)),
10211024
_ => zulipLocalizations.manyPeopleTyping,
10221025
};
10231026

test/widgets/message_list_test.dart

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

0 commit comments

Comments
 (0)