await sending a message before clearing composer (this was missing all along)

This commit is contained in:
Bruno Windels 2021-08-06 18:02:03 +02:00
parent 053c94b60e
commit 9f0c3b9cea
2 changed files with 4 additions and 4 deletions

View file

@ -47,8 +47,8 @@ export class ComposerViewModel extends ViewModel {
return this._roomVM.isEncrypted; return this._roomVM.isEncrypted;
} }
sendMessage(message) { async sendMessage(message) {
const success = this._roomVM._sendMessage(message, this._replyVM); const success = await this._roomVM._sendMessage(message, this._replyVM);
if (success) { if (success) {
this._isEmpty = true; this._isEmpty = true;
this.emitChange("canSend"); this.emitChange("canSend");

View file

@ -69,9 +69,9 @@ export class MessageComposer extends TemplateView {
this.value.clearReplyingTo(); this.value.clearReplyingTo();
} }
_trySend() { async _trySend() {
this._input.focus(); this._input.focus();
if (this.value.sendMessage(this._input.value)) { if (await this.value.sendMessage(this._input.value)) {
this._input.value = ""; this._input.value = "";
} }
} }