Skip to content

Commit fea048b

Browse files
committed
msglist: Exclude muted users from typing-status text
Following web: #1429 (review)
1 parent b090b5f commit fea048b

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

test/widgets/message_list_test.dart

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

0 commit comments

Comments
 (0)