You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-25 05:23:13 +03:00
replace Bluebird::map
This commit is contained in:
@@ -1806,17 +1806,15 @@ Crypto.prototype.exportRoomKeys = async function() {
|
|||||||
* @return {module:client.Promise} a promise which resolves once the keys have been imported
|
* @return {module:client.Promise} a promise which resolves once the keys have been imported
|
||||||
*/
|
*/
|
||||||
Crypto.prototype.importRoomKeys = function(keys) {
|
Crypto.prototype.importRoomKeys = function(keys) {
|
||||||
return Promise.map(
|
return Promise.all(keys.map((key) => {
|
||||||
keys, (key) => {
|
if (!key.room_id || !key.algorithm) {
|
||||||
if (!key.room_id || !key.algorithm) {
|
logger.warn("ignoring room key entry with missing fields", key);
|
||||||
logger.warn("ignoring room key entry with missing fields", key);
|
return null;
|
||||||
return null;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const alg = this._getRoomDecryptor(key.room_id, key.algorithm);
|
const alg = this._getRoomDecryptor(key.room_id, key.algorithm);
|
||||||
return alg.importRoomKey(key);
|
return alg.importRoomKey(key);
|
||||||
},
|
}));
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2767,14 +2765,10 @@ Crypto.prototype._processReceivedRoomKeyRequests = async function() {
|
|||||||
// cancellation (and end up with a cancelled request), rather than the
|
// cancellation (and end up with a cancelled request), rather than the
|
||||||
// cancellation before the request (and end up with an outstanding
|
// cancellation before the request (and end up with an outstanding
|
||||||
// request which should have been cancelled.)
|
// request which should have been cancelled.)
|
||||||
await Promise.map(
|
await Promise.all(requests.map((req) =>
|
||||||
requests, (req) =>
|
this._processReceivedRoomKeyRequest(req)));
|
||||||
this._processReceivedRoomKeyRequest(req),
|
await Promise.all(cancellations.map((cancellation) =>
|
||||||
);
|
this._processReceivedRoomKeyRequestCancellation(cancellation)));
|
||||||
await Promise.map(
|
|
||||||
cancellations, (cancellation) =>
|
|
||||||
this._processReceivedRoomKeyRequestCancellation(cancellation),
|
|
||||||
);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error(`Error processing room key requsts: ${e}`);
|
logger.error(`Error processing room key requsts: ${e}`);
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user