Skip to content

Commit

Permalink
Merge pull request #54144 from ugogiordano/main
Browse files Browse the repository at this point in the history
fix 51501
  • Loading branch information
jasperhuangg authored Dec 30, 2024
2 parents 483d287 + 6702f9f commit 83aae80
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1753,6 +1753,7 @@ const translations = {
},
onboarding: {
welcome: 'Welcome!',
welcomeSignOffTitle: "It's great to meet you!",
explanationModal: {
title: 'Welcome to Expensify',
description: 'One app to handle your business and personal spend at the speed of chat. Try it out and let us know what you think. Much more to come!',
Expand Down
1 change: 1 addition & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1756,6 +1756,7 @@ const translations = {
},
onboarding: {
welcome: '¡Bienvenido!',
welcomeSignOffTitle: '¡Es un placer conocerte!',
explanationModal: {
title: 'Bienvenido a Expensify',
description: 'Una aplicación para gestionar en un chat todos los gastos de tu empresa y personales. Inténtalo y dinos qué te parece. ¡Hay mucho más por venir!',
Expand Down
45 changes: 42 additions & 3 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3672,6 +3672,20 @@ function prepareOnboardingOptimisticData(
};
});

// Sign-off welcome message
const welcomeSignOffComment = ReportUtils.buildOptimisticAddCommentReportAction(
Localize.translateLocal('onboarding.welcomeSignOffTitle'),
undefined,
actorAccountID,
tasksData.length + 3,
);
const welcomeSignOffCommentAction: OptimisticAddCommentReportAction = welcomeSignOffComment.reportAction;
const welcomeSignOffMessage = {
reportID: targetChatReportID,
reportActionID: welcomeSignOffCommentAction.reportActionID,
reportComment: welcomeSignOffComment.commentText,
};

const tasksForParameters = tasksData.map<TaskForParameters>(({task, currentTask, taskCreatedAction, taskReportAction, taskDescription, completedTaskReportAction}) => ({
type: 'task',
task: task.type,
Expand Down Expand Up @@ -3827,8 +3841,7 @@ function prepareOnboardingOptimisticData(
}, []);

const optimisticData: OnyxUpdate[] = [...tasksForOptimisticData];
const lastVisibleActionCreated =
tasksData.at(-1)?.completedTaskReportAction?.created ?? tasksData.at(-1)?.taskReportAction.reportAction.created ?? videoCommentAction?.created ?? textCommentAction.created;
const lastVisibleActionCreated = welcomeSignOffCommentAction.created;

optimisticData.push(
{
Expand Down Expand Up @@ -4019,7 +4032,33 @@ function prepareOnboardingOptimisticData(
});
}

guidedSetupData.push(...tasksForParameters);
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${targetChatReportID}`,
value: {
[welcomeSignOffCommentAction.reportActionID]: welcomeSignOffCommentAction as ReportAction,
},
});

successData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${targetChatReportID}`,
value: {
[welcomeSignOffCommentAction.reportActionID]: {pendingAction: null},
},
});

failureData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${targetChatReportID}`,
value: {
[welcomeSignOffCommentAction.reportActionID]: {
errors: ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('report.genericAddCommentFailureMessage'),
} as ReportAction,
},
});

guidedSetupData.push(...tasksForParameters, {type: 'message', ...welcomeSignOffMessage});

return {optimisticData, successData, failureData, guidedSetupData, actorAccountID};
}
Expand Down

0 comments on commit 83aae80

Please sign in to comment.