From b2e5f7de3358d866ecbe60e9e0a30dca68366a39 Mon Sep 17 00:00:00 2001 From: Cesar Gonzalez Date: Thu, 6 Jul 2023 10:06:24 -0500 Subject: [PATCH] [PM-482] Desktop Application is Minimized When There is a Master Password Reprompt and Copying Vault Item Password (#5635) --- apps/desktop/src/vault/app/vault/view.component.ts | 10 +++++++--- libs/angular/src/vault/components/view.component.ts | 8 +++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/apps/desktop/src/vault/app/vault/view.component.ts b/apps/desktop/src/vault/app/vault/view.component.ts index 1555199d0c..07fd92e032 100644 --- a/apps/desktop/src/vault/app/vault/view.component.ts +++ b/apps/desktop/src/vault/app/vault/view.component.ts @@ -106,9 +106,13 @@ export class ViewComponent extends BaseViewComponent implements OnChanges { this.onViewCipherPasswordHistory.emit(this.cipher); } - async copy(value: string, typeI18nKey: string, aType: string) { - super.copy(value, typeI18nKey, aType); - this.messagingService.send("minimizeOnCopy"); + async copy(value: string, typeI18nKey: string, aType: string): Promise { + const hasCopied = await super.copy(value, typeI18nKey, aType); + if (hasCopied) { + this.messagingService.send("minimizeOnCopy"); + } + + return hasCopied; } onWindowHidden() { diff --git a/libs/angular/src/vault/components/view.component.ts b/libs/angular/src/vault/components/view.component.ts index afe7d7ed57..1236e07bd7 100644 --- a/libs/angular/src/vault/components/view.component.ts +++ b/libs/angular/src/vault/components/view.component.ts @@ -316,16 +316,16 @@ export class ViewComponent implements OnDestroy, OnInit { this.platformUtilsService.launchUri(uri.launchUri); } - async copy(value: string, typeI18nKey: string, aType: string) { + async copy(value: string, typeI18nKey: string, aType: string): Promise { if (value == null) { - return; + return false; } if ( this.passwordRepromptService.protectedFields().includes(aType) && !(await this.promptPassword()) ) { - return; + return false; } const copyOptions = this.win != null ? { window: this.win } : null; @@ -343,6 +343,8 @@ export class ViewComponent implements OnDestroy, OnInit { } else if (aType === "H_Field") { this.eventCollectionService.collect(EventType.Cipher_ClientCopiedHiddenField, this.cipherId); } + + return true; } setTextDataOnDrag(event: DragEvent, data: string) {