From b35583a5ac6fe68024cc681ebb63cdb214985da1 Mon Sep 17 00:00:00 2001 From: Jordan Aasen <166539328+jaasen-livefront@users.noreply.github.com> Date: Wed, 18 Jun 2025 15:27:14 -0700 Subject: [PATCH] prevent double MP prompt on copy and delete (#15218) --- .../src/vault/app/vault/item-footer.component.ts | 5 +++-- .../src/vault/app/vault/vault-v2.component.html | 1 + .../src/vault/app/vault/vault-v2.component.ts | 13 ++++++++----- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/apps/desktop/src/vault/app/vault/item-footer.component.ts b/apps/desktop/src/vault/app/vault/item-footer.component.ts index d83a530cc40..675a8403b20 100644 --- a/apps/desktop/src/vault/app/vault/item-footer.component.ts +++ b/apps/desktop/src/vault/app/vault/item-footer.component.ts @@ -25,6 +25,7 @@ export class ItemFooterComponent implements OnInit { @Input() collectionId: string | null = null; @Input({ required: true }) action: string = "view"; @Input() isSubmitting: boolean = false; + @Input() masterPasswordAlreadyPrompted: boolean = false; @Output() onEdit = new EventEmitter(); @Output() onClone = new EventEmitter(); @Output() onDelete = new EventEmitter(); @@ -34,8 +35,7 @@ export class ItemFooterComponent implements OnInit { canDeleteCipher$: Observable = new Observable(); activeUserId: UserId | null = null; - - private passwordReprompted = false; + passwordReprompted: boolean = false; constructor( protected cipherService: CipherService, @@ -51,6 +51,7 @@ export class ItemFooterComponent implements OnInit { async ngOnInit() { this.canDeleteCipher$ = this.cipherAuthorizationService.canDeleteCipher$(this.cipher); this.activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId)); + this.passwordReprompted = this.masterPasswordAlreadyPrompted; } async clone() { diff --git a/apps/desktop/src/vault/app/vault/vault-v2.component.html b/apps/desktop/src/vault/app/vault/vault-v2.component.html index 4dd23466126..f1cb28f3ea5 100644 --- a/apps/desktop/src/vault/app/vault/vault-v2.component.html +++ b/apps/desktop/src/vault/app/vault/vault-v2.component.html @@ -20,6 +20,7 @@ (onDelete)="deleteCipher()" (onCancel)="cancelCipher($event)" [isSubmitting]="isSubmitting" + [masterPasswordAlreadyPrompted]="cipherRepromptId === cipherId" >
diff --git a/apps/desktop/src/vault/app/vault/vault-v2.component.ts b/apps/desktop/src/vault/app/vault/vault-v2.component.ts index 354752c8b36..849899bfe66 100644 --- a/apps/desktop/src/vault/app/vault/vault-v2.component.ts +++ b/apps/desktop/src/vault/app/vault/vault-v2.component.ts @@ -744,10 +744,17 @@ export class VaultV2Component implements OnInit, OnDestroy, CopyClickListener { } async editFolder(folderId: string) { + if (!this.activeUserId) { + return; + } const folderView = await firstValueFrom( this.folderService.getDecrypted$(folderId, this.activeUserId), ); + if (!folderView) { + return; + } + const dialogRef = AddEditFolderDialogComponent.open(this.dialogService, { editFolderConfig: { folder: { @@ -762,7 +769,7 @@ export class VaultV2Component implements OnInit, OnDestroy, CopyClickListener { result === AddEditFolderDialogResult.Deleted || result === AddEditFolderDialogResult.Created ) { - await this.vaultFilterComponent.reloadCollectionsAndFolders(this.activeFilter); + await this.vaultFilterComponent?.reloadCollectionsAndFolders(this.activeFilter); } } @@ -807,10 +814,6 @@ export class VaultV2Component implements OnInit, OnDestroy, CopyClickListener { .catch(() => {}); } - private addCipherWithChangeDetection(type: CipherType) { - this.functionWithChangeDetection(() => this.addCipher(type).catch(() => {})); - } - private copyValue(cipher: CipherView, value: string, labelI18nKey: string, aType: string) { this.functionWithChangeDetection(() => { (async () => {