filter out deleted ciphers in popup service (#10035)
This commit is contained in:
parent
91294e9c4d
commit
c7d64cfc25
|
@ -311,6 +311,19 @@ describe("VaultPopupItemsService", () => {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should return true when all ciphers are deleted", (done) => {
|
||||||
|
cipherServiceMock.getAllDecrypted.mockResolvedValue([
|
||||||
|
{ id: "1", type: CipherType.Login, name: "Login 1", isDeleted: true },
|
||||||
|
{ id: "2", type: CipherType.Login, name: "Login 2", isDeleted: true },
|
||||||
|
{ id: "3", type: CipherType.Login, name: "Login 3", isDeleted: true },
|
||||||
|
] as CipherView[]);
|
||||||
|
|
||||||
|
service.emptyVault$.subscribe((empty) => {
|
||||||
|
expect(empty).toBe(true);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("noFilteredResults$", () => {
|
describe("noFilteredResults$", () => {
|
||||||
|
|
|
@ -87,14 +87,16 @@ export class VaultPopupItemsService {
|
||||||
map(([organizations, collections]) => {
|
map(([organizations, collections]) => {
|
||||||
const orgMap = Object.fromEntries(organizations.map((org) => [org.id, org]));
|
const orgMap = Object.fromEntries(organizations.map((org) => [org.id, org]));
|
||||||
const collectionMap = Object.fromEntries(collections.map((col) => [col.id, col]));
|
const collectionMap = Object.fromEntries(collections.map((col) => [col.id, col]));
|
||||||
return ciphers.map(
|
return ciphers
|
||||||
(cipher) =>
|
.filter((c) => !c.isDeleted)
|
||||||
new PopupCipherView(
|
.map(
|
||||||
cipher,
|
(cipher) =>
|
||||||
cipher.collectionIds?.map((colId) => collectionMap[colId as CollectionId]),
|
new PopupCipherView(
|
||||||
orgMap[cipher.organizationId as OrganizationId],
|
cipher,
|
||||||
),
|
cipher.collectionIds?.map((colId) => collectionMap[colId as CollectionId]),
|
||||||
);
|
orgMap[cipher.organizationId as OrganizationId],
|
||||||
|
),
|
||||||
|
);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in New Issue