diff --git a/mobile/lib/features/activity/inbox_item.dart b/mobile/lib/features/activity/inbox_item.dart index 701d3c15090..a21a0e5188a 100644 --- a/mobile/lib/features/activity/inbox_item.dart +++ b/mobile/lib/features/activity/inbox_item.dart @@ -134,7 +134,10 @@ class InboxItem { ); } - final category = item.categories.firstOrNull ?? item.item.category; + // Label the event the row displays. A group can hold an older mention and + // a newer plain reply; the row shows the reply, so it must not say + // "Mentioned in". [InboxItem.categories] still drives filtering. + final category = item.item.category; if (category == 'mention') { return ( text: channelName != null ? 'Mentioned in' : 'Mentioned', diff --git a/mobile/test/features/activity/inbox_item_test.dart b/mobile/test/features/activity/inbox_item_test.dart index d163d403b11..19ca22fe9b2 100644 --- a/mobile/test/features/activity/inbox_item_test.dart +++ b/mobile/test/features/activity/inbox_item_test.dart @@ -382,5 +382,32 @@ void main() { ); expect(label.text, 'Thread in'); }); + + test('labels the displayed event, not an older mention in its thread', () { + final row = buildInboxItems([ + item( + id: threadIdInboxA, + createdAt: 100, + category: 'mention', + tags: replyTags(threadIdInboxR, threadIdInboxP), + ), + item( + id: threadIdInboxB, + createdAt: 200, + category: 'activity', + pubkey: 'pk2', + tags: replyTags(threadIdInboxR, threadIdInboxA), + ), + ]).single; + final label = inboxTypeLabel( + row, + channelName: 'general', + isDm: false, + senderLabel: 'Bob', + ); + expect(row.item.id, threadIdInboxB); + expect(label.text, 'Thread in'); + expect(matchesInboxFilter(row, InboxFilter.mention), isTrue); + }); }); }