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

Simplify Set

This commit is contained in:
Will Hunt
2019-07-29 15:29:18 +01:00
committed by GitHub
parent 4f0f2e8c16
commit c9bf61c387

View File

@@ -62,7 +62,6 @@ Promise.config({warnings: false});
const SCROLLBACK_DELAY_MS = 3000; const SCROLLBACK_DELAY_MS = 3000;
const CRYPTO_ENABLED = isCryptoAvailable(); const CRYPTO_ENABLED = isCryptoAvailable();
const CAPABILITIES_CACHE_MS = 21600000; // 6 hours - an arbitrary value const CAPABILITIES_CACHE_MS = 21600000; // 6 hours - an arbitrary value
const MAX_TOMBSTONE_HISTORY = 30;
function keysFromRecoverySession(sessions, decryptionKey, roomId) { function keysFromRecoverySession(sessions, decryptionKey, roomId) {
const keys = []; const keys = [];
@@ -2382,8 +2381,8 @@ MatrixClient.prototype.getRoomUpgradeHistory = function(roomId, verifyLinks=fals
// Push to the end because we're looking forwards // Push to the end because we're looking forwards
upgradeHistory.push(refRoom); upgradeHistory.push(refRoom);
const roomIds = upgradeHistory.map((ref) => ref.roomId); const roomIds = new Set(upgradeHistory.map((ref) => ref.roomId));
if ((new Set(roomIds)).size < roomIds.length) { if (roomIds.size < upgradeHistory.length) {
// The last room added to the list introduced a previous roomId // The last room added to the list introduced a previous roomId
// To avoid recursion, return the last rooms - 1 // To avoid recursion, return the last rooms - 1
return upgradeHistory.slice(0, upgradeHistory.length - 1); return upgradeHistory.slice(0, upgradeHistory.length - 1);