Skip to content

Commit

Permalink
Merge pull request #44690 from Expensify/arosiclair-fix-open-report-e…
Browse files Browse the repository at this point in the history
…rrors

[No QA] Fix all report errorFields getting cleared and INTEGRATIONSMESSAGE copy
  • Loading branch information
arosiclair authored Jul 2, 2024
2 parents 9fbbbfb + afc914f commit 07c8af7
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import type {
GoBackMessageParams,
GoToRoomParams,
InstantSummaryParams,
IntegrationsMessageParams,
LocalTimeParams,
LoggedInAsParams,
LogSizeParams,
Expand Down Expand Up @@ -3133,7 +3132,7 @@ export default {
exportedToCSV: `exported this report to CSV`,
exportedToIntegration: ({label}: ExportedToIntegrationParams) => `exported this report to ${label}`,
forwarded: ({amount, currency}: ForwardedParams) => `approved ${currency}${amount}`,
integrationsMessage: ({errorMessage, label}: IntegrationsMessageParams) => `failed to export this report to ${label}. ${errorMessage}`,
integrationsMessage: (errorMessage: string, label: string) => `failed to export this report to ${label} ("${errorMessage}").`,
managerAttachReceipt: `added a receipt`,
managerDetachReceipt: `removed the receipt`,
markedReimbursed: ({amount, currency}: MarkedReimbursedParams) => `paid ${currency}${amount} elsewhere`,
Expand Down
3 changes: 1 addition & 2 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import type {
GoBackMessageParams,
GoToRoomParams,
InstantSummaryParams,
IntegrationsMessageParams,
LocalTimeParams,
LoggedInAsParams,
LogSizeParams,
Expand Down Expand Up @@ -3169,7 +3168,7 @@ export default {
exportedToCSV: `exportó este informe a CSV`,
exportedToIntegration: ({label}: ExportedToIntegrationParams) => `exportó este informe a ${label}`,
forwarded: ({amount, currency}: ForwardedParams) => `aprobado ${currency}${amount}`,
integrationsMessage: ({errorMessage, label}: IntegrationsMessageParams) => `no se pudo exportar este informe a ${label}. ${errorMessage}`,
integrationsMessage: (errorMessage: string, label: string) => `no se pudo exportar este informe a ${label} ("${errorMessage}").`,
managerAttachReceipt: `agregó un recibo`,
managerDetachReceipt: `quitó el recibo`,
markedReimbursed: ({amount, currency}: MarkedReimbursedParams) => `pagó ${currency}${amount} en otro lugar`,
Expand Down
13 changes: 12 additions & 1 deletion src/languages/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,18 @@ type ExportedToIntegrationParams = {label: string};

type ForwardedParams = {amount: string; currency: string};

type IntegrationsMessageParams = {errorMessage: string; label: string};
type IntegrationsMessageParams = {
label: string;
result: {
code?: number;
messages?: string[];
title?: string;
link?: {
url: string;
text: string;
};
};
};

type MarkedReimbursedParams = {amount: string; currency: string};

Expand Down
5 changes: 3 additions & 2 deletions src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1256,8 +1256,9 @@ function getMessageOfOldDotReportAction(oldDotAction: PartialReportAction | OldD
case CONST.REPORT.ACTIONS.TYPE.EXPORTED_TO_INTEGRATION:
return Localize.translateLocal('report.actions.type.exportedToIntegration', {label: originalMessage.label});
case CONST.REPORT.ACTIONS.TYPE.INTEGRATIONS_MESSAGE: {
const {errorMessage, label} = originalMessage;
return Localize.translateLocal('report.actions.type.integrationsMessage', {errorMessage, label});
const {result, label} = originalMessage;
const errorMessage = result?.messages?.join(', ') ?? '';
return Localize.translateLocal('report.actions.type.integrationsMessage', errorMessage, label);
}
case CONST.REPORT.ACTIONS.TYPE.MANAGER_ATTACH_RECEIPT:
return Localize.translateLocal('report.actions.type.managerAttachReceipt');
Expand Down
4 changes: 3 additions & 1 deletion src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,9 @@ function openReport(
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
value: {
errorFields: null,
errorFields: {
notFound: null,
},
},
},
{
Expand Down

0 comments on commit 07c8af7

Please sign in to comment.