Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: disable engagement modal display for anonymous users #37673

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading