Skip to content

Commit fcc2c8b

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

File tree

2 files changed

+30
-5
lines changed

2 files changed

+30
-5
lines changed

lib/widgets/message_list.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,13 +1327,14 @@ class _TypingStatusWidgetState extends State<TypingStatusWidget> with PerAccount
13271327
final store = PerAccountStoreWidget.of(context);
13281328
final zulipLocalizations = ZulipLocalizations.of(context);
13291329
final typistIds = model!.typistIdsInNarrow(narrow);
1330-
if (typistIds.isEmpty) return const SizedBox();
1331-
final text = switch (typistIds.length) {
1330+
final filteredTypistIds = typistIds.whereNot(store.isUserMuted);
1331+
if (filteredTypistIds.isEmpty) return const SizedBox();
1332+
final text = switch (filteredTypistIds.length) {
13321333
1 => zulipLocalizations.onePersonTyping(
1333-
store.userDisplayName(typistIds.first)),
1334+
store.userDisplayName(filteredTypistIds.first)),
13341335
2 => zulipLocalizations.twoPeopleTyping(
1335-
store.userDisplayName(typistIds.first),
1336-
store.userDisplayName(typistIds.last)),
1336+
store.userDisplayName(filteredTypistIds.first),
1337+
store.userDisplayName(filteredTypistIds.last)),
13371338
_ => zulipLocalizations.manyPeopleTyping,
13381339
};
13391340

test/widgets/message_list_test.dart

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,30 @@ void main() {
893893
// Wait for the pending timers to end.
894894
await tester.pump(const Duration(seconds: 15));
895895
});
896+
897+
testWidgets('muted user typing', (tester) async {
898+
await setupMessageListPage(tester,
899+
narrow: topicNarrow, users: users, messages: [streamMessage]);
900+
901+
await checkTyping(tester,
902+
eg.typingEvent(topicNarrow, TypingOp.start, eg.otherUser.userId),
903+
expected: 'Other User is typing…');
904+
905+
await checkTyping(tester,
906+
eg.typingEvent(topicNarrow, TypingOp.start, eg.thirdUser.userId),
907+
expected: 'Other User and Third User are typing…');
908+
909+
await store.setMutedUsers([eg.otherUser.userId]);
910+
await tester.pump();
911+
912+
await checkTyping(tester,
913+
eg.typingEvent(topicNarrow, TypingOp.start, eg.thirdUser.userId),
914+
expected: 'Third User is typing…', // no "Other User"
915+
);
916+
917+
// Wait for the pending timers to end.
918+
await tester.pump(const Duration(seconds: 15));
919+
});
896920
});
897921

898922
group('MarkAsReadWidget', () {

0 commit comments

Comments
 (0)