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

put canRestore in class property

This commit is contained in:
jaasen-livefront
2025-01-16 13:06:13 -08:00
parent 306b630489
commit 6e4d94085c

View File

@@ -204,7 +204,11 @@ export class VaultItemDialogComponent implements OnInit, OnDestroy {
),
);
protected async showRestore() {
/**
* Determines if the user may restore the item.
* A user may restore items if they have delete permissions and the item is in the trash.
*/
protected async canUserRestore() {
return (
this.filter?.type === "trash" &&
this.cipher?.isDeleted &&
@@ -212,6 +216,8 @@ export class VaultItemDialogComponent implements OnInit, OnDestroy {
);
}
protected showRestore: boolean;
protected get loadingForm() {
return this.loadForm && !this.formReady;
}
@@ -276,6 +282,7 @@ export class VaultItemDialogComponent implements OnInit, OnDestroy {
async ngOnInit() {
this.cipher = await this.getDecryptedCipherView(this.formConfig);
this.showRestore = await this.canUserRestore();
if (this.cipher) {
if (this.cipher.decryptionFailure) {