move attachment sending check to be earlier

fixes sending with keyboard before attachment uploaded
This commit is contained in:
Henry Hiles 2026-07-29 12:11:57 -04:00
commit d7f49568a7
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
2 changed files with 7 additions and 6 deletions

View file

@ -125,11 +125,9 @@ class RoomChatController extends AsyncNotifier<IList<Event>?> {
if (relationType == .edit) {
baseContent = relation?.content;
} else {
final attachment = ref.watch(AttachmentController.provider(roomId));
if (attachment != null && attachment.$2 == null) return;
baseContent = attachment?.$2;
ref.invalidate(AttachmentController.provider(roomId));
final provider = AttachmentController.provider(roomId);
baseContent = ref.watch(provider)?.$2;
ref.invalidate(provider);
}
var taggedMessage = text;

View file

@ -59,7 +59,10 @@ class Composer extends HookConsumerWidget {
final attachment = ref.watch(AttachmentController.provider(roomId));
void send() {
if (controller.value.text.isEmpty && attachment == null) return;
if (controller.value.text.isEmpty && attachment == null ||
attachment != null && attachment.$2 == null) {
return;
}
onSend(
controller.value.formattedText,
shouldMention: shouldMention.value,