Skip to content

Commit 14b42ab

Browse files
committed
Re-check key backup status on version mismatch
This ensures we will report the updated status when consumer code asks for it. Fixes part of element-hq/element-web#8048.
1 parent e8022e9 commit 14b42ab

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/crypto/index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,9 @@ Crypto.prototype._checkAndStartKeyBackup = async function() {
246246

247247
/**
248248
* Forces a re-check of the key backup and enables/disables it
249-
* as appropriate
250-
*
251-
* @param {object} backupInfo Backup info from /room_keys/version endpoint
249+
* as appropriate.
252250
*/
253-
Crypto.prototype.checkKeyBackup = async function(backupInfo) {
251+
Crypto.prototype.checkKeyBackup = async function() {
254252
this._checkedForBackup = false;
255253
await this._checkAndStartKeyBackup();
256254
};
@@ -1021,6 +1019,9 @@ Crypto.prototype._scheduleKeyBackupSend = async function() {
10211019
err.data.errcode == 'M_NOT_FOUND' ||
10221020
err.data.errcode == 'M_WRONG_ROOM_KEYS_VERSION'
10231021
) {
1022+
// Re-check key backup status on error, so we can be
1023+
// sure to present the current situation when asked.
1024+
await this.checkKeyBackup();
10241025
// Backup version has changed or this backup version
10251026
// has been deleted
10261027
this.emit("crypto.keyBackupFailed", err.data.errcode);

0 commit comments

Comments
 (0)