forked from Nexus/nexus
move attachment sending check to be earlier
fixes sending with keyboard before attachment uploaded
This commit is contained in:
parent
f0f426a647
commit
d7f49568a7
2 changed files with 7 additions and 6 deletions
|
|
@ -125,11 +125,9 @@ class RoomChatController extends AsyncNotifier<IList<Event>?> {
|
||||||
if (relationType == .edit) {
|
if (relationType == .edit) {
|
||||||
baseContent = relation?.content;
|
baseContent = relation?.content;
|
||||||
} else {
|
} else {
|
||||||
final attachment = ref.watch(AttachmentController.provider(roomId));
|
final provider = AttachmentController.provider(roomId);
|
||||||
if (attachment != null && attachment.$2 == null) return;
|
baseContent = ref.watch(provider)?.$2;
|
||||||
|
ref.invalidate(provider);
|
||||||
baseContent = attachment?.$2;
|
|
||||||
ref.invalidate(AttachmentController.provider(roomId));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var taggedMessage = text;
|
var taggedMessage = text;
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,10 @@ class Composer extends HookConsumerWidget {
|
||||||
final attachment = ref.watch(AttachmentController.provider(roomId));
|
final attachment = ref.watch(AttachmentController.provider(roomId));
|
||||||
|
|
||||||
void send() {
|
void send() {
|
||||||
if (controller.value.text.isEmpty && attachment == null) return;
|
if (controller.value.text.isEmpty && attachment == null ||
|
||||||
|
attachment != null && attachment.$2 == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
onSend(
|
onSend(
|
||||||
controller.value.formattedText,
|
controller.value.formattedText,
|
||||||
shouldMention: shouldMention.value,
|
shouldMention: shouldMention.value,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue