1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

expose prepareToEncrypt in the client API

This commit is contained in:
Hubert Chathi
2020-03-18 18:53:26 -04:00
parent b2e154377a
commit 9911766435
3 changed files with 23 additions and 2 deletions

View File

@@ -767,8 +767,6 @@ MegolmEncryption.prototype._notifyBlockedDevices = async function(
* @param {module:models/room} room the room the event is in
*/
MegolmEncryption.prototype.prepareToEncrypt = function(room) {
logger.debug(`Preparing to encrypt events for ${this._roomId}`);
if (this.encryptionPreparation) {
// We're already preparing something, so don't do anything else.
// FIXME: check if we need to restart
@@ -776,6 +774,8 @@ MegolmEncryption.prototype.prepareToEncrypt = function(room) {
return;
}
logger.debug(`Preparing to encrypt events for ${this._roomId}`);
this.encryptionPreparation = (async () => {
const [devicesInRoom, blocked] = await this._getDevicesInRoom(room);