Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion mobile/lib/features/channels/message_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ Iterable<String> _mentionAliases(Iterable<String> mentionNames) sync* {
for (final name in mentionNames) {
final trimmed = name.trim();
if (trimmed.isEmpty) continue;
yield trimmed;
yield trimmed.replaceAll(' ', '\u00A0');
Comment thread
brow marked this conversation as resolved.
Outdated
final firstName = trimmed.split(RegExp(r'\s+')).first;
if (firstName.isNotEmpty) {
yield firstName;
Expand Down
17 changes: 17 additions & 0 deletions mobile/test/features/channels/message_content_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,23 @@ void main() {
expect(find.text('@Alice'), findsOneWidget);
});

testWidgets('highlights an entire multi-word display name', (
tester,
) async {
await tester.pumpWidget(
_testable(
const MessageContent(
content: 'Hey @Kenny Lopez can you review this?',
mentionNames: {'pk1': 'Kenny Lopez'},
),
),
);

expect(find.text('@Kenny Lopez'), findsOneWidget);
expect(find.text('@Kenny'), findsNothing);
expect(_allRichText(tester), isNot(contains('Lopez Lopez')));
});

testWidgets('renders unknown @mention as-is', (tester) async {
await tester.pumpWidget(
_testable(
Expand Down
Loading