From 92f3630fed85f224a6f8a6fc20a10dac22d84687 Mon Sep 17 00:00:00 2001 From: Nick Krantz <125900171+nick-livefront@users.noreply.github.com> Date: Thu, 5 Jun 2025 09:18:43 -0500 Subject: [PATCH] rework logic for empty vault nudge (#15013) --- .../empty-vault-nudge.service.ts | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/libs/angular/src/vault/services/custom-nudges-services/empty-vault-nudge.service.ts b/libs/angular/src/vault/services/custom-nudges-services/empty-vault-nudge.service.ts index 9763c20299..3122bdac2e 100644 --- a/libs/angular/src/vault/services/custom-nudges-services/empty-vault-nudge.service.ts +++ b/libs/angular/src/vault/services/custom-nudges-services/empty-vault-nudge.service.ts @@ -44,18 +44,22 @@ export class EmptyVaultNudgeService extends DefaultSingleNudgeService { const hasManageCollections = collections.some( (c) => c.manage && orgIds.has(c.organizationId), ); - // Do not show nudge when - // user has previously dismissed nudge - // OR - // user belongs to an organization and cannot create collections || manage collections - if ( - nudgeStatus.hasBadgeDismissed || - nudgeStatus.hasSpotlightDismissed || - hasManageCollections || - canCreateCollections - ) { + + // When the user has dismissed the nudge or spotlight, return the nudge status directly + if (nudgeStatus.hasBadgeDismissed || nudgeStatus.hasSpotlightDismissed) { return of(nudgeStatus); } + + // When the user belongs to an organization and cannot create collections or manage collections, + // hide the nudge and spotlight + if (!hasManageCollections && !canCreateCollections) { + return of({ + hasSpotlightDismissed: true, + hasBadgeDismissed: true, + }); + } + + // Otherwise, return the nudge status based on the vault contents return of({ hasSpotlightDismissed: vaultHasContents, hasBadgeDismissed: vaultHasContents,