1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

Merge pull request #1087 from matrix-org/t3chguy/remove_bluebird_11

Remove Bluebird: phase 2
This commit is contained in:
Michael Telatynski
2019-11-26 00:03:22 +00:00
committed by GitHub
19 changed files with 271 additions and 213 deletions

View File

@@ -1824,17 +1824,15 @@ Crypto.prototype.exportRoomKeys = async function() {
* @return {module:client.Promise} a promise which resolves once the keys have been imported
*/
Crypto.prototype.importRoomKeys = function(keys) {
return Promise.map(
keys, (key) => {
if (!key.room_id || !key.algorithm) {
logger.warn("ignoring room key entry with missing fields", key);
return null;
}
return Promise.all(keys.map((key) => {
if (!key.room_id || !key.algorithm) {
logger.warn("ignoring room key entry with missing fields", key);
return null;
}
const alg = this._getRoomDecryptor(key.room_id, key.algorithm);
return alg.importRoomKey(key);
},
);
const alg = this._getRoomDecryptor(key.room_id, key.algorithm);
return alg.importRoomKey(key);
}));
};
/**
@@ -2858,14 +2856,10 @@ Crypto.prototype._processReceivedRoomKeyRequests = async function() {
// cancellation (and end up with a cancelled request), rather than the
// cancellation before the request (and end up with an outstanding
// request which should have been cancelled.)
await Promise.map(
requests, (req) =>
this._processReceivedRoomKeyRequest(req),
);
await Promise.map(
cancellations, (cancellation) =>
this._processReceivedRoomKeyRequestCancellation(cancellation),
);
await Promise.all(requests.map((req) =>
this._processReceivedRoomKeyRequest(req)));
await Promise.all(cancellations.map((cancellation) =>
this._processReceivedRoomKeyRequestCancellation(cancellation)));
} catch (e) {
logger.error(`Error processing room key requsts: ${e}`);
} finally {