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

Do not set optimistic nvp_onboarding for invited users #51440

Merged
merged 7 commits into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
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
13 changes: 12 additions & 1 deletion src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7381,7 +7381,18 @@ function completePaymentOnboarding(paymentSelected: ValueOf<typeof CONST.PAYMENT
onboardingPurpose = CONST.ONBOARDING_CHOICES.CHAT_SPLIT;
}

Report.completeOnboarding(onboardingPurpose, CONST.ONBOARDING_MESSAGES[onboardingPurpose], personalDetails?.firstName ?? '', personalDetails?.lastName ?? '', paymentSelected);
Report.completeOnboarding(
onboardingPurpose,
CONST.ONBOARDING_MESSAGES[onboardingPurpose],
personalDetails?.firstName ?? '',
personalDetails?.lastName ?? '',
undefined,
undefined,
paymentSelected,
undefined,
undefined,
true,
);
}

function payMoneyRequest(paymentType: PaymentMethodType, chatReport: OnyxTypes.Report, iouReport: OnyxEntry<OnyxTypes.Report>, full = true) {
Expand Down
20 changes: 14 additions & 6 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3463,6 +3463,7 @@ function prepareOnboardingOptimisticData(
adminsChatReportID?: string,
onboardingPolicyID?: string,
userReportedIntegration?: OnboardingAccounting,
wasInvited?: boolean,
) {
// If the user has the "combinedTrackSubmit" beta enabled we'll show different tasks for track and submit expense.
if (Permissions.canUseCombinedTrackSubmit()) {
Expand Down Expand Up @@ -3741,12 +3742,14 @@ function prepareOnboardingOptimisticData(
key: ONYXKEYS.NVP_INTRO_SELECTED,
value: {choice: engagementChoice},
},
{
);
if (!wasInvited) {
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.NVP_ONBOARDING,
value: {hasCompletedGuidedSetupFlow: true},
},
);
});
}

const successData: OnyxUpdate[] = [...tasksForSuccessData];
successData.push({
Expand Down Expand Up @@ -3801,12 +3804,15 @@ function prepareOnboardingOptimisticData(
key: ONYXKEYS.NVP_INTRO_SELECTED,
value: {choice: null},
},
{
);

if (!wasInvited) {
failureData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: ONYXKEYS.NVP_ONBOARDING,
value: {hasCompletedGuidedSetupFlow: false},
},
);
});
}

if (userReportedIntegration) {
optimisticData.push({
Expand Down Expand Up @@ -3890,13 +3896,15 @@ function completeOnboarding(
paymentSelected?: string,
companySize?: OnboardingCompanySize,
userReportedIntegration?: OnboardingAccounting,
wasInvited?: boolean,
) {
const {optimisticData, successData, failureData, guidedSetupData, actorAccountID} = prepareOnboardingOptimisticData(
engagementChoice,
data,
adminsChatReportID,
onboardingPolicyID,
userReportedIntegration,
wasInvited,
);

const parameters: CompleteGuidedSetupParams = {
Expand Down
Loading