1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-25 12:15:18 +01:00

Add premium dialog when trying to navigate to attachments without premium permissions (#11387)

This commit is contained in:
Nick Krantz 2024-10-04 08:30:39 -05:00 committed by GitHub
parent f82563ee23
commit 8ec5517809
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View File

@ -207,6 +207,7 @@ export class VaultItemDialogComponent implements OnInit, OnDestroy {
private accountService: AccountService,
private router: Router,
private billingAccountProfileStateService: BillingAccountProfileStateService,
private premiumUpgradeService: PremiumUpgradePromptService,
) {
this.updateTitle();
}
@ -297,6 +298,13 @@ export class VaultItemDialogComponent implements OnInit, OnDestroy {
};
openAttachmentsDialog = async () => {
const canAccessAttachments = await firstValueFrom(this.canAccessAttachments$);
if (!canAccessAttachments) {
await this.premiumUpgradeService.promptForPremium();
return;
}
const dialogRef = this.dialogService.open<AttachmentDialogCloseResult, { cipherId: CipherId }>(
AttachmentsV2Component,
{

View File

@ -611,6 +611,12 @@ export class VaultComponent implements OnInit, OnDestroy {
const result = await lastValueFrom(this.vaultItemDialogRef.closed);
this.vaultItemDialogRef = undefined;
// When the dialog is closed for a premium upgrade, return early as the user
// should be navigated to the subscription settings elsewhere
if (result === VaultItemDialogResult.PremiumUpgrade) {
return;
}
// If the dialog was closed by deleting the cipher, refresh the vault.
if (result === VaultItemDialogResult.Deleted || result === VaultItemDialogResult.Saved) {
this.refresh();