From fd498b3d24df28b60ab8a8e204a07339b67edb62 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 10 Nov 2020 14:02:07 +0100 Subject: [PATCH] no need to keep track of promise, fn is internally rate-limited now --- src/domain/session/room/RoomViewModel.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/domain/session/room/RoomViewModel.js b/src/domain/session/room/RoomViewModel.js index c872ca0f..8811625a 100644 --- a/src/domain/session/room/RoomViewModel.js +++ b/src/domain/session/room/RoomViewModel.js @@ -169,7 +169,6 @@ class ComposerViewModel extends ViewModel { super(); this._roomVM = roomVM; this._isEmpty = true; - this._ensureKeyPromise = null; } get isEncrypted() { @@ -192,10 +191,8 @@ class ComposerViewModel extends ViewModel { async setInput(text) { const wasEmpty = this._isEmpty; this._isEmpty = text.length === 0; - if (wasEmpty && !this._isEmpty && !this._ensureKeyPromise) { - this._ensureKeyPromise = this._roomVM._room.ensureMessageKeyIsShared().then(() => { - this._ensureKeyPromise = null; - }); + if (wasEmpty && !this._isEmpty) { + this._roomVM._room.ensureMessageKeyIsShared(); } if (wasEmpty !== this._isEmpty) { this.emitChange("canSend");