File tree Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -1208,6 +1208,19 @@ MatrixClient.prototype.scheduleAllGroupSessionsForBackup = async function() {
1208
1208
await this . _crypto . scheduleAllGroupSessionsForBackup ( ) ;
1209
1209
} ;
1210
1210
1211
+ /**
1212
+ * Marks all group sessions as needing to be backed up without scheduling
1213
+ * them to upload in the background.
1214
+ * @returns {Promise<int> } Resolves to the number of sessions requiring a backup.
1215
+ */
1216
+ MatrixClient . prototype . flagAllGroupSessionsForBackup = function ( ) {
1217
+ if ( this . _crypto === null ) {
1218
+ throw new Error ( "End-to-end encryption disabled" ) ;
1219
+ }
1220
+
1221
+ return this . _crypto . flagAllGroupSessionsForBackup ( ) ;
1222
+ } ;
1223
+
1211
1224
MatrixClient . prototype . isValidRecoveryKey = function ( recoveryKey ) {
1212
1225
try {
1213
1226
decodeRecoveryKey ( recoveryKey ) ;
Original file line number Diff line number Diff line change @@ -1288,6 +1288,18 @@ Crypto.prototype.backupGroupSession = async function(
1288
1288
* upload in the background as soon as possible.
1289
1289
*/
1290
1290
Crypto . prototype . scheduleAllGroupSessionsForBackup = async function ( ) {
1291
+ await this . flagAllGroupSessionsForBackup ( ) ;
1292
+
1293
+ // Schedule keys to upload in the background as soon as possible.
1294
+ this . scheduleKeyBackupSend ( 0 /* maxDelay */ ) ;
1295
+ } ;
1296
+
1297
+ /**
1298
+ * Marks all group sessions as needing to be backed up without scheduling
1299
+ * them to upload in the background.
1300
+ * @returns {Promise<int> } Resolves to the number of sessions requiring a backup.
1301
+ */
1302
+ Crypto . prototype . flagAllGroupSessionsForBackup = async function ( ) {
1291
1303
await this . _cryptoStore . doTxn (
1292
1304
'readwrite' ,
1293
1305
[
@@ -1305,9 +1317,7 @@ Crypto.prototype.scheduleAllGroupSessionsForBackup = async function() {
1305
1317
1306
1318
const remaining = await this . _cryptoStore . countSessionsNeedingBackup ( ) ;
1307
1319
this . emit ( "crypto.keyBackupSessionsRemaining" , remaining ) ;
1308
-
1309
- // Schedule keys to upload in the background as soon as possible.
1310
- this . scheduleKeyBackupSend ( 0 /* maxDelay */ ) ;
1320
+ return remaining ;
1311
1321
} ;
1312
1322
1313
1323
/* eslint-disable valid-jsdoc */ //https://github.com/eslint/eslint/issues/7307
You can’t perform that action at this time.
0 commit comments