@@ -94,18 +94,22 @@ class _InboxPageState extends State<InboxPage> with PerAccountStoreAwareStateMix
94
94
// TODO efficiently include DM conversations that aren't recent enough
95
95
// to appear in recentDmConversationsView, but still have unreads in
96
96
// unreadsModel.
97
- final dmItems = < (DmNarrow , int )> [];
97
+ final dmItems = < (DmNarrow , int , bool )> [];
98
98
int allDmsCount = 0 ;
99
+ bool allDmsHasMention = false ;
99
100
for (final dmNarrow in recentDmConversationsModel! .sorted) {
100
101
final countInNarrow = unreadsModel! .countInDmNarrow (dmNarrow);
101
102
if (countInNarrow == 0 ) {
102
103
continue ;
103
104
}
104
- dmItems.add ((dmNarrow, countInNarrow));
105
+ final hasMention = unreadsModel! .dms[dmNarrow]! .any (
106
+ (messageId) => unreadsModel! .mentions.contains (messageId));
107
+ if (hasMention) allDmsHasMention = true ;
108
+ dmItems.add ((dmNarrow, countInNarrow, hasMention));
105
109
allDmsCount += countInNarrow;
106
110
}
107
111
if (allDmsCount > 0 ) {
108
- sections.add (_AllDmsSectionData (allDmsCount, dmItems));
112
+ sections.add (_AllDmsSectionData (allDmsCount, allDmsHasMention, dmItems));
109
113
}
110
114
111
115
final sortedUnreadStreams = unreadsModel! .streams.entries
@@ -184,9 +188,10 @@ sealed class _InboxSectionData {
184
188
185
189
class _AllDmsSectionData extends _InboxSectionData {
186
190
final int count;
187
- final List <(DmNarrow , int )> items;
191
+ final bool hasMention;
192
+ final List <(DmNarrow , int , bool )> items;
188
193
189
- const _AllDmsSectionData (this .count, this .items);
194
+ const _AllDmsSectionData (this .count, this .hasMention, this . items);
190
195
}
191
196
192
197
class _StreamSectionData extends _InboxSectionData {
@@ -296,7 +301,7 @@ class _AllDmsSection extends StatelessWidget {
296
301
Widget build (BuildContext context) {
297
302
final header = _AllDmsHeaderItem (
298
303
count: data.count,
299
- hasMention: false ,
304
+ hasMention: data.hasMention ,
300
305
collapsed: collapsed,
301
306
pageState: pageState,
302
307
);
@@ -305,10 +310,11 @@ class _AllDmsSection extends StatelessWidget {
305
310
child: Column (children: [
306
311
header,
307
312
if (! collapsed) ...data.items.map ((item) {
308
- final (narrow, count) = item;
313
+ final (narrow, count, hasMention ) = item;
309
314
return _DmItem (
310
315
narrow: narrow,
311
316
count: count,
317
+ hasMention: hasMention,
312
318
);
313
319
}),
314
320
]));
@@ -319,10 +325,12 @@ class _DmItem extends StatelessWidget {
319
325
const _DmItem ({
320
326
required this .narrow,
321
327
required this .count,
328
+ required this .hasMention,
322
329
});
323
330
324
331
final DmNarrow narrow;
325
332
final int count;
333
+ final bool hasMention;
326
334
327
335
@override
328
336
Widget build (BuildContext context) {
@@ -361,6 +369,7 @@ class _DmItem extends StatelessWidget {
361
369
overflow: TextOverflow .ellipsis,
362
370
title))),
363
371
const SizedBox (width: 12 ),
372
+ if (hasMention) const _AtMentionMarker (),
364
373
Padding (padding: const EdgeInsetsDirectional .only (end: 16 ),
365
374
child: UnreadCountBadge (backgroundColor: null ,
366
375
count: count)),
0 commit comments