fix: Only look at online keybackup for automated requests

This commit is contained in:
Sorunome 2020-10-28 11:27:36 +01:00
parent 412da6ae0c
commit 955fb747c2
No known key found for this signature in database
GPG Key ID: B19471D07FC9BE9C
1 changed files with 5 additions and 5 deletions

View File

@ -215,7 +215,7 @@ class KeyManager {
// do e2ee recovery // do e2ee recovery
_requestedSessionIds.add(requestIdent); _requestedSessionIds.add(requestIdent);
unawaited(runInRoot(() => unawaited(runInRoot(() =>
request(room, sessionId, senderKey, askOnlyOwnDevices: true))); request(room, sessionId, senderKey, onlineKeyBackupOnly: true)));
} }
return null; return null;
} }
@ -544,7 +544,7 @@ class KeyManager {
String sessionId, String sessionId,
String senderKey, { String senderKey, {
bool tryOnlineBackup = true, bool tryOnlineBackup = true,
bool askOnlyOwnDevices = false, bool onlineKeyBackupOnly = false,
}) async { }) async {
if (tryOnlineBackup && await isCached()) { if (tryOnlineBackup && await isCached()) {
// let's first check our online key backup store thingy... // let's first check our online key backup store thingy...
@ -568,13 +568,13 @@ class KeyManager {
return; // we managed to load the session from online backup, no need to care about it now return; // we managed to load the session from online backup, no need to care about it now
} }
} }
if (onlineKeyBackupOnly) {
return; // we only want to do the online key backup
}
try { try {
// while we just send the to-device event to '*', we still need to save the // while we just send the to-device event to '*', we still need to save the
// devices themself to know where to send the cancel to after receiving a reply // devices themself to know where to send the cancel to after receiving a reply
final devices = await room.getUserDeviceKeys(); final devices = await room.getUserDeviceKeys();
if (askOnlyOwnDevices) {
devices.removeWhere((d) => d.userId != client.userID);
}
final requestId = client.generateUniqueTransactionId(); final requestId = client.generateUniqueTransactionId();
final request = KeyManagerKeyShareRequest( final request = KeyManagerKeyShareRequest(
requestId: requestId, requestId: requestId,