From 9f0c3b9cea0004e5ad9a6e26e64b0375304cd4eb Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 6 Aug 2021 18:02:03 +0200 Subject: [PATCH] await sending a message before clearing composer (this was missing all along) --- src/domain/session/room/ComposerViewModel.js | 4 ++-- src/platform/web/ui/session/room/MessageComposer.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/domain/session/room/ComposerViewModel.js b/src/domain/session/room/ComposerViewModel.js index 3ee7f8e3..240e7d4c 100644 --- a/src/domain/session/room/ComposerViewModel.js +++ b/src/domain/session/room/ComposerViewModel.js @@ -47,8 +47,8 @@ export class ComposerViewModel extends ViewModel { return this._roomVM.isEncrypted; } - sendMessage(message) { - const success = this._roomVM._sendMessage(message, this._replyVM); + async sendMessage(message) { + const success = await this._roomVM._sendMessage(message, this._replyVM); if (success) { this._isEmpty = true; this.emitChange("canSend"); diff --git a/src/platform/web/ui/session/room/MessageComposer.js b/src/platform/web/ui/session/room/MessageComposer.js index 20fd3659..5a6ba593 100644 --- a/src/platform/web/ui/session/room/MessageComposer.js +++ b/src/platform/web/ui/session/room/MessageComposer.js @@ -69,9 +69,9 @@ export class MessageComposer extends TemplateView { this.value.clearReplyingTo(); } - _trySend() { + async _trySend() { this._input.focus(); - if (this.value.sendMessage(this._input.value)) { + if (await this.value.sendMessage(this._input.value)) { this._input.value = ""; } }