1
0
mirror of https://github.com/bitwarden/browser synced 2026-03-02 11:31:44 +00:00

[PM-24533] Initialize Archive Feature (#16226)

* [PM-19237] Add Archive Filter Type (#13852)
* Browser can archive and unarchive items
* Create Archive Cipher Service
* Add flag and premium permissions to Archive 

---------

Co-authored-by: SmithThe4th <gsmith@bitwarden.com>
Co-authored-by: Shane <smelton@bitwarden.com>
Co-authored-by: Patrick Pimentel <ppimentel@bitwarden.com>
This commit is contained in:
Jason Ng
2025-09-22 11:06:02 -04:00
committed by GitHub
parent 04881556df
commit dbec02cf8d
48 changed files with 1166 additions and 62 deletions

View File

@@ -68,6 +68,7 @@ const cipherData: CipherData = {
deletedDate: null,
permissions: new CipherPermissionsApi(),
key: "EncKey",
archivedDate: null,
reprompt: CipherRepromptType.None,
login: {
uris: [

View File

@@ -286,6 +286,7 @@ export class CipherService implements CipherServiceAbstraction {
cipher.collectionIds = model.collectionIds;
cipher.creationDate = model.creationDate;
cipher.revisionDate = model.revisionDate;
cipher.archivedDate = model.archivedDate;
cipher.reprompt = model.reprompt;
cipher.edit = model.edit;
@@ -634,6 +635,10 @@ export class CipherService implements CipherServiceAbstraction {
);
defaultMatch ??= await firstValueFrom(this.domainSettingsService.defaultUriMatchStrategy$);
const archiveFeatureEnabled = await this.configService.getFeatureFlag(
FeatureFlag.PM19148_InnovationArchive,
);
return ciphers.filter((cipher) => {
const type = CipherViewLikeUtils.getType(cipher);
const login = CipherViewLikeUtils.getLogin(cipher);
@@ -643,6 +648,10 @@ export class CipherService implements CipherServiceAbstraction {
return false;
}
if (archiveFeatureEnabled && CipherViewLikeUtils.isArchived(cipher)) {
return false;
}
if (Array.isArray(includeOtherTypes) && includeOtherTypes.includes(type) && !cipherIsLogin) {
return true;
}
@@ -666,8 +675,16 @@ export class CipherService implements CipherServiceAbstraction {
userId: UserId,
): Promise<CipherView[]> {
const ciphers = await this.getAllDecrypted(userId);
const archiveFeatureEnabled = await this.configService.getFeatureFlag(
FeatureFlag.PM19148_InnovationArchive,
);
return ciphers
.filter((cipher) => cipher.deletedDate == null && type.includes(cipher.type))
.filter(
(cipher) =>
cipher.deletedDate == null &&
(!archiveFeatureEnabled || !cipher.isArchived) &&
type.includes(cipher.type),
)
.sort((a, b) => this.sortCiphersByLastUsedThenName(a, b));
}

View File

@@ -48,7 +48,8 @@ const cipherData: CipherData = {
name: "EncryptedString",
notes: "EncryptedString",
creationDate: "2022-01-01T12:00:00.000Z",
deletedDate: null,
deletedDate: undefined,
archivedDate: undefined,
permissions: new CipherPermissionsApi(),
key: "EncKey",
reprompt: CipherRepromptType.None,