Skip to content

Commit

Permalink
Merge pull request #37673 from aswin-s/fix/issue-35531
Browse files Browse the repository at this point in the history
fix: disable engagement modal display for anonymous users
  • Loading branch information
luacmartins authored Mar 4, 2024
2 parents c932d31 + 7b01ecc commit 875402d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/libs/actions/Welcome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type OnyxPolicy from '@src/types/onyx/Policy';
import type Report from '@src/types/onyx/Report';
import type {EmptyObject} from '@src/types/utils/EmptyObject';
import * as Policy from './Policy';
import * as Session from './Session';

let resolveIsReadyPromise: (value?: Promise<void>) => void | undefined;
let isReadyPromise = new Promise<void>((resolve) => {
Expand Down Expand Up @@ -168,7 +169,14 @@ function show(routes: State<RootStackParamList>['routes'] | undefined, showEngag

// If user is not already an admin of a free policy and we are not navigating them to their workspace or creating a new workspace via workspace/new then
// we will show the engagement modal.
if (!Policy.isAdminOfFreePolicy(allPolicies ?? undefined) && !isExitingToWorkspaceRoute && !hasSelectedChoice && !hasDismissedModal && Object.keys(allPolicies ?? {}).length === 1) {
if (
!Session.isAnonymousUser() &&
!Policy.isAdminOfFreePolicy(allPolicies ?? undefined) &&
!isExitingToWorkspaceRoute &&
!hasSelectedChoice &&
!hasDismissedModal &&
Object.keys(allPolicies ?? {}).length === 1
) {
showEngagementModal();
}

Expand Down

0 comments on commit 875402d

Please sign in to comment.