1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-20 19:34:03 +00:00

feat(archive): Desktop - Desktop archive and unarchive are working, bug with delete is present with the server. Fixing

This commit is contained in:
Patrick Pimentel
2025-06-02 11:41:25 -04:00
parent 8cebfff2fb
commit 678263a81c
8 changed files with 24 additions and 24 deletions

View File

@@ -191,7 +191,8 @@ export class Fido2Component implements OnInit, OnDestroy {
this.accountService.activeAccount$.pipe(getUserId),
);
this.ciphers = (await this.cipherService.getAllDecrypted(activeUserId)).filter(
(cipher) => cipher.type === CipherType.Login && !cipher.isDeleted,
(cipher) =>
cipher.type === CipherType.Login && !cipher.isDeleted && !cipher.isArchived,
);
this.displayedCiphers = this.ciphers.filter(

View File

@@ -198,7 +198,7 @@ export class VaultV2Component implements OnInit, AfterViewInit, OnDestroy {
this.cipherService
.failedToDecryptCiphers$(this.activeUserId)
.pipe(
map((ciphers) => (ciphers ? ciphers.filter((c) => !c.isDeleted) : [])),
map((ciphers) => (ciphers ? ciphers.filter((c) => !c.isDeleted || !c.isArchived) : [])),
filter((ciphers) => ciphers.length > 0),
take(1),
takeUntilDestroyed(this.destroyRef),

View File

@@ -1933,9 +1933,12 @@
"message": "Item permanently deleted"
},
"archiveItem": {
"message": "Archive item"
},
"archivedItem": {
"message": "Item archived"
},
"unarchiveItem": {
"unarchivedItem": {
"message": "Item unarchived"
},
"restoredItem": {

View File

@@ -293,9 +293,9 @@ export class VaultComponent implements OnInit, OnDestroy {
if (params.deleted) {
cipherStatus = "trash";
} else if (params.archived){
} else if (params.archived) {
cipherStatus = "archive";
} else if (params.favorites){
} else if (params.favorites) {
cipherStatus = "favorites";
}
@@ -342,7 +342,7 @@ export class VaultComponent implements OnInit, OnDestroy {
return;
}
if (!cipher.isDeleted) {
if (!cipher.isDeleted || !cipher.isArchived) {
menu.push({
label: this.i18nService.t("edit"),
click: () =>
@@ -680,6 +680,7 @@ export class VaultComponent implements OnInit, OnDestroy {
await this.vaultItemsComponent.reload(
this.activeFilter.buildFilter(),
vaultFilter.status === "trash",
vaultFilter.status === "archive",
);
this.go();
}

View File

@@ -684,12 +684,7 @@
</button>
</ng-container>
<div class="right">
<button
type="button"
(click)="archive()"
class="danger"
[appA11yTitle]="'archive' | i18n"
>
<button type="button" (click)="archive()" [appA11yTitle]="'archive' | i18n">
<i class="bwi bwi-archive bwi-lg bwi-fw" aria-hidden="true"></i>
</button>
<button

View File

@@ -32,6 +32,7 @@ export class VaultItemsComponent implements OnInit, OnDestroy {
loaded = false;
ciphers: CipherView[] = [];
deleted = false;
archived = false;
organization: Organization;
CipherType = CipherType;
@@ -84,19 +85,20 @@ export class VaultItemsComponent implements OnInit, OnDestroy {
this.destroy$.complete();
}
async load(filter: (cipher: CipherView) => boolean = null, deleted = false) {
async load(filter: (cipher: CipherView) => boolean = null, deleted = false, archived = false) {
this.deleted = deleted ?? false;
this.archived = archived ?? false;
await this.applyFilter(filter);
this.loaded = true;
}
async reload(filter: (cipher: CipherView) => boolean = null, deleted = false) {
async reload(filter: (cipher: CipherView) => boolean = null, deleted = false, archived = false) {
this.loaded = false;
await this.load(filter, deleted);
await this.load(filter, deleted, archived);
}
async refresh() {
await this.reload(this.filter, this.deleted);
await this.reload(this.filter, this.deleted, this.archived);
}
async applyFilter(filter: (cipher: CipherView) => boolean = null) {
@@ -123,6 +125,7 @@ export class VaultItemsComponent implements OnInit, OnDestroy {
return !this.searchPending && this.isSearchable;
}
protected archivedFilter: (cipher: CipherView) => boolean = (c) => c.isArchived === this.archived;
protected deletedFilter: (cipher: CipherView) => boolean = (c) => c.isDeleted === this.deleted;
/**
@@ -154,7 +157,7 @@ export class VaultItemsComponent implements OnInit, OnDestroy {
return this.searchService.searchCiphers(
userId,
searchText,
[filter, this.deletedFilter],
[filter, this.deletedFilter, this.archivedFilter],
allCiphers,
);
}),

View File

@@ -39,9 +39,6 @@ export class VaultFilter {
buildFilter(): VaultFilterFunction {
return (cipher) => {
console.log(cipher);
console.log(this.status);
let cipherPassesFilter = true;
if (this.status === "favorites" && cipherPassesFilter) {
cipherPassesFilter = cipher.favorite;

View File

@@ -135,14 +135,14 @@ export class CipherView implements View, InitializerMetadata {
return this.login.passwordRevisionDate;
}
get isDeleted(): boolean {
return this.deletedDate != null;
}
get isArchived(): boolean {
return this.archivedDate != null;
}
get isDeleted(): boolean {
return this.deletedDate != null;
}
get linkedFieldOptions() {
return this.item?.linkedFieldOptions;
}