diff --git a/lib/controllers/room_chat.dart b/lib/controllers/room_chat.dart index ac979e0..558817c 100644 --- a/lib/controllers/room_chat.dart +++ b/lib/controllers/room_chat.dart @@ -121,9 +121,16 @@ class RoomChatController extends AsyncNotifier?> { required RelationType relationType, Event? relation, }) async { - final attachment = ref.watch(AttachmentController.provider(roomId)); + Content? baseContent; + if (relationType == .edit) { + baseContent = relation?.content; + } else { + final attachment = ref.watch(AttachmentController.provider(roomId)); + if (attachment != null && attachment.$2 == null) return; - if (attachment != null && attachment.$2 == null) return; + baseContent = attachment?.$2; + ref.invalidate(AttachmentController.provider(roomId)); + } var taggedMessage = text; @@ -141,7 +148,7 @@ class RoomChatController extends AsyncNotifier?> { final event = await client.sendMessage( SendMessageRequest( roomId: roomId, - baseContent: attachment?.$2, + baseContent: baseContent, mentions: Mentions( userIds: [ if (shouldMention == true && @@ -158,8 +165,6 @@ class RoomChatController extends AsyncNotifier?> { ), ); - ref.invalidate(AttachmentController.provider(roomId)); - ref .watch(RoomsController.provider.notifier) .update(