Merge pull request #686 from zjs81/fix/copy-full-and-special-messages

Preserve reply mentions and support copying image messages
This commit is contained in:
zjs81 authored and GitHub committed 2026-11-21 09:29:37 -07:00
commit 787f1bb931
6 files changed
+703 -6

No files matched your search

@@ -1,4 +1,5 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:meshcore_open/models/bookmarked_message.dart';
import 'package:meshcore_open/models/channel_message.dart';
void main() {
@@ -25,5 +26,52 @@ void main() {
test('outgoing message without reply has no reply target', () {
final message = ChannelMessage.outgoing('hello', 'Me', 0);
expect(message.replyToMessageId, isNull);
expect(message.fullText, 'hello');
});
test('fullText restores @[username] prefix for stored replies', () {
final storedReply = ChannelMessage(
senderName: 'Me',
text: 'answer',
timestamp: DateTime(2026, 1, 1, 12),
isOutgoing: true,
replyToMessageId: 'msg-1',
replyToSenderName: 'Alice',
replyToText: 'question',
);
expect(storedReply.fullText, '@[Alice] answer');
final bookmark = BookmarkedMessage.fromChannel(
message: storedReply,
channelId: 'ch-0',
channelName: 'Public',
senderName: 'Me',
);
expect(bookmark.text, '@[Alice] answer');
});
test('fullText preserves nested mention and special payloads in replies', () {
final nestedReply = ChannelMessage(
senderName: 'Bob',
text: '@[Alice] nested',
timestamp: DateTime(2026, 1, 1, 12),
isOutgoing: false,
replyToMessageId: 'msg-1',
replyToSenderName: 'Alice',
replyToText: 'original',
);
expect(nestedReply.fullText, '@[Alice] @[Alice] nested');
final gifReply = ChannelMessage(
senderName: 'Bob',
text: 'g:abc123',
timestamp: DateTime(2026, 1, 1, 12),
isOutgoing: false,
replyToMessageId: 'msg-1',
replyToSenderName: 'Alice',
replyToText: 'original',
);
expect(gifReply.fullText, '@[Alice] g:abc123');
});
}