From 2aa0ad672ee087eb8208005ac2eec106fa9f7d54 Mon Sep 17 00:00:00 2001 From: Jordan Aasen <166539328+jaasen-livefront@users.noreply.github.com> Date: Wed, 8 Oct 2025 14:12:45 -0700 Subject: [PATCH] [PM-12030] - add "Edit" and "Delete" options to browser more items menu (#16764) * add "Edit" and "Delete" options to browser more items menu * remove redundant check --- .../item-more-options.component.html | 12 +++++++ .../item-more-options.component.ts | 35 +++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/apps/browser/src/vault/popup/components/vault-v2/item-more-options/item-more-options.component.html b/apps/browser/src/vault/popup/components/vault-v2/item-more-options/item-more-options.component.html index 7ee7e141ee..3a48f7eb44 100644 --- a/apps/browser/src/vault/popup/components/vault-v2/item-more-options/item-more-options.component.html +++ b/apps/browser/src/vault/popup/components/vault-v2/item-more-options/item-more-options.component.html @@ -26,6 +26,11 @@ + @if (canEdit) { + + } {{ "clone" | i18n }} @@ -43,5 +48,12 @@ {{ "archiveVerb" | i18n }} } + @if (canDelete$ | async) { + + } diff --git a/apps/browser/src/vault/popup/components/vault-v2/item-more-options/item-more-options.component.ts b/apps/browser/src/vault/popup/components/vault-v2/item-more-options/item-more-options.component.ts index 324ea2ffcd..ebcd870759 100644 --- a/apps/browser/src/vault/popup/components/vault-v2/item-more-options/item-more-options.component.ts +++ b/apps/browser/src/vault/popup/components/vault-v2/item-more-options/item-more-options.component.ts @@ -120,6 +120,10 @@ export class ItemMoreOptionsComponent { }), ); + protected canDelete$ = this._cipher$.pipe( + switchMap((cipher) => this.cipherAuthorizationService.canDeleteCipher$(cipher)), + ); + constructor( private cipherService: CipherService, private passwordRepromptService: PasswordRepromptService, @@ -252,6 +256,37 @@ export class ItemMoreOptionsComponent { }); } + protected async edit() { + if (this.cipher.reprompt && !(await this.passwordRepromptService.showPasswordPrompt())) { + return; + } + + await this.router.navigate(["/edit-cipher"], { + queryParams: { cipherId: this.cipher.id, type: CipherViewLikeUtils.getType(this.cipher) }, + }); + } + + protected async delete() { + const confirmed = await this.dialogService.openSimpleDialog({ + title: { key: "deleteItem" }, + content: { key: "deleteItemConfirmation" }, + type: "warning", + }); + + if (!confirmed) { + return; + } + + const activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId)); + + await this.cipherService.softDeleteWithServer(this.cipher.id as CipherId, activeUserId); + + this.toastService.showToast({ + variant: "success", + message: this.i18nService.t("deletedItem"), + }); + } + async archive() { const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "archiveItem" },