Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion mobile/lib/features/activity/inbox_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
27 changes: 27 additions & 0 deletions mobile/test/features/activity/inbox_item_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
}
Loading