1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-27 01:53:23 +00:00

[PM-31675] remove archive from web edit (#18764)

* refactor default cipher archive service, update archive/unarchive in vault-item-dialog, remove archive/unarchive items in edit form
This commit is contained in:
Jason Ng
2026-02-09 16:17:46 -05:00
committed by jaasen-livefront
parent 8e9a9c7e32
commit d7cbfebfab
6 changed files with 66 additions and 60 deletions

View File

@@ -91,21 +91,11 @@ export class DefaultCipherArchiveService implements CipherArchiveService {
const response = new ListResponse(r, CipherResponse);
const currentCiphers = await firstValueFrom(this.cipherService.ciphers$(userId));
// prevent mutating ciphers$ state
const localCiphers = structuredClone(currentCiphers);
const responseDataArray = response.data.map(
(cipher) => new CipherData(cipher, currentCiphers[cipher.id as CipherId]?.collectionIds),
);
for (const cipher of response.data) {
const localCipher = localCiphers[cipher.id as CipherId];
if (localCipher == null) {
continue;
}
localCipher.archivedDate = cipher.archivedDate;
localCipher.revisionDate = cipher.revisionDate;
}
await this.cipherService.upsert(Object.values(localCiphers), userId);
await this.cipherService.upsert(responseDataArray, userId);
return response.data[0];
}
@@ -115,21 +105,11 @@ export class DefaultCipherArchiveService implements CipherArchiveService {
const response = new ListResponse(r, CipherResponse);
const currentCiphers = await firstValueFrom(this.cipherService.ciphers$(userId));
// prevent mutating ciphers$ state
const localCiphers = structuredClone(currentCiphers);
const responseDataArray = response.data.map(
(cipher) => new CipherData(cipher, currentCiphers[cipher.id as CipherId]?.collectionIds),
);
for (const cipher of response.data) {
const localCipher = localCiphers[cipher.id as CipherId];
if (localCipher == null) {
continue;
}
localCipher.archivedDate = cipher.archivedDate;
localCipher.revisionDate = cipher.revisionDate;
}
await this.cipherService.upsert(Object.values(localCiphers), userId);
await this.cipherService.upsert(responseDataArray, userId);
return response.data[0];
}
}