1
1
import 'package:flutter/material.dart' ;
2
2
3
+ import '../generated/l10n/zulip_localizations.dart' ;
3
4
import '../model/narrow.dart' ;
4
5
import '../model/recent_dm_conversations.dart' ;
5
6
import '../model/unreads.dart' ;
@@ -79,6 +80,7 @@ class RecentDmConversationsItem extends StatelessWidget {
79
80
@override
80
81
Widget build (BuildContext context) {
81
82
final store = PerAccountStoreWidget .of (context);
83
+ final localizations = ZulipLocalizations .of (context);
82
84
final designVariables = DesignVariables .of (context);
83
85
84
86
final String title;
@@ -88,16 +90,26 @@ class RecentDmConversationsItem extends StatelessWidget {
88
90
title = store.selfUser.fullName;
89
91
avatar = AvatarImage (userId: store.selfUserId, size: _avatarSize);
90
92
case [var otherUserId]:
91
- // TODO(#296) actually don't show this row if the user is muted?
92
- // (should we offer a "spam folder" style summary screen of recent
93
- // 1:1 DM conversations from muted users?)
94
- title = store.userDisplayName (otherUserId);
95
- avatar = AvatarImage (userId: otherUserId, size: _avatarSize);
93
+ // Although we currently don't display a DM conversation with a muted
94
+ // user, maybe in the future we will have the "Search by location"
95
+ // feature similar to Web where a DM conversation with a muted user is
96
+ // displayed if searched for explicitly; for example using: "dm:Bo Lin".
97
+ // https://zulip.com/help/search-for-messages#search-by-location
98
+ final isUserMuted = store.isUserMuted (otherUserId);
99
+ title = isUserMuted
100
+ ? localizations.mutedUser
101
+ : store.userDisplayName (otherUserId);
102
+ avatar = isUserMuted
103
+ ? AvatarPlaceholder (size: _avatarSize)
104
+ : AvatarImage (userId: otherUserId, size: _avatarSize);
96
105
default :
97
106
// TODO(i18n): List formatting, like you can do in JavaScript:
98
107
// new Intl.ListFormat('ja').format(['Chris', 'Greg', 'Alya'])
99
108
// // 'Chris、Greg、Alya'
100
- title = narrow.otherRecipientIds.map (store.userDisplayName)
109
+ title = narrow.otherRecipientIds.map ((id) =>
110
+ store.isUserMuted (id)
111
+ ? localizations.mutedUser
112
+ : store.userDisplayName (id))
101
113
.join (', ' );
102
114
avatar = ColoredBox (color: designVariables.groupDmConversationIconBg,
103
115
child: Center (
0 commit comments