mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
rework logic for empty vault nudge (#15013)
This commit is contained in:
@@ -44,18 +44,22 @@ export class EmptyVaultNudgeService extends DefaultSingleNudgeService {
|
|||||||
const hasManageCollections = collections.some(
|
const hasManageCollections = collections.some(
|
||||||
(c) => c.manage && orgIds.has(c.organizationId),
|
(c) => c.manage && orgIds.has(c.organizationId),
|
||||||
);
|
);
|
||||||
// Do not show nudge when
|
|
||||||
// user has previously dismissed nudge
|
// When the user has dismissed the nudge or spotlight, return the nudge status directly
|
||||||
// OR
|
if (nudgeStatus.hasBadgeDismissed || nudgeStatus.hasSpotlightDismissed) {
|
||||||
// user belongs to an organization and cannot create collections || manage collections
|
|
||||||
if (
|
|
||||||
nudgeStatus.hasBadgeDismissed ||
|
|
||||||
nudgeStatus.hasSpotlightDismissed ||
|
|
||||||
hasManageCollections ||
|
|
||||||
canCreateCollections
|
|
||||||
) {
|
|
||||||
return of(nudgeStatus);
|
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({
|
return of({
|
||||||
hasSpotlightDismissed: vaultHasContents,
|
hasSpotlightDismissed: vaultHasContents,
|
||||||
hasBadgeDismissed: vaultHasContents,
|
hasBadgeDismissed: vaultHasContents,
|
||||||
|
|||||||
Reference in New Issue
Block a user