1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-01-11 19:40:47 +01:00

Revert "make getAllDecrypted synchronous"

This reverts commit 51ee0b065a.
This commit is contained in:
Kyle Spearrin 2018-07-23 14:24:27 -04:00
parent 04014a8e78
commit c7e8f1d13f
3 changed files with 17 additions and 9 deletions

View File

@ -181,10 +181,13 @@ export class CipherService implements CipherServiceAbstraction {
throw new Error('No key.');
}
const promises: any[] = [];
const ciphers = await this.getAll();
for (let i = 0; i < ciphers.length; i++) {
decCiphers.push(await ciphers[i].decrypt());
}
ciphers.forEach((cipher) => {
promises.push(cipher.decrypt().then((c) => decCiphers.push(c)));
});
await Promise.all(promises);
decCiphers.sort(this.getLocaleSortingFunction());
this.decryptedCipherCache = decCiphers;
return this.decryptedCipherCache;

View File

@ -48,9 +48,11 @@ export class CollectionService implements CollectionServiceAbstraction {
return [];
}
const decCollections: CollectionView[] = [];
for (let i = 0; i < collections.length; i++) {
decCollections.push(await collections[i].decrypt());
}
const promises: Array<Promise<any>> = [];
collections.forEach((collection) => {
promises.push(collection.decrypt().then((c) => decCollections.push(c)));
});
await Promise.all(promises);
return decCollections.sort(Utils.getSortFunction(this.i18nService, 'name'));
}

View File

@ -78,10 +78,13 @@ export class FolderService implements FolderServiceAbstraction {
}
const decFolders: FolderView[] = [];
const promises: Array<Promise<any>> = [];
const folders = await this.getAll();
for (let i = 0; i < folders.length; i++) {
decFolders.push(await folders[i].decrypt());
}
folders.forEach((folder) => {
promises.push(folder.decrypt().then((f) => decFolders.push(f)));
});
await Promise.all(promises);
decFolders.sort(Utils.getSortFunction(this.i18nService, 'name'));
const noneFolder = new FolderView();