From b0e256f7d819c3a3bc124352e7c7de39045a735f Mon Sep 17 00:00:00 2001 From: Andrew Rosiclair Date: Thu, 15 Aug 2024 13:14:42 -0400 Subject: [PATCH 1/3] render INTEGRATIONSYNCFAILED actions --- src/CONST.ts | 1 + src/languages/en.ts | 1 + src/pages/home/report/ReportActionItem.tsx | 3 +++ src/types/onyx/OriginalMessage.ts | 16 ++++++++++++++++ 4 files changed, 21 insertions(+) diff --git a/src/CONST.ts b/src/CONST.ts index 3327a8ad88b6..816b3331e1d2 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -708,6 +708,7 @@ const CONST = { FORWARDED: 'FORWARDED', // OldDot Action HOLD: 'HOLD', HOLD_COMMENT: 'HOLDCOMMENT', + INTEGRATION_SYNC_FAILED: 'INTEGRATIONSYNCFAILED', IOU: 'IOU', INTEGRATIONS_MESSAGE: 'INTEGRATIONSMESSAGE', // OldDot Action MANAGER_ATTACH_RECEIPT: 'MANAGERATTACHRECEIPT', // OldDot Action diff --git a/src/languages/en.ts b/src/languages/en.ts index 95fc367504b4..bd5ee3fc5f11 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -3821,6 +3821,7 @@ export default { stripePaid: ({amount, currency}: StripePaidParams) => `paid ${currency}${amount}`, takeControl: `took control`, unapproved: ({amount, currency}: UnapprovedParams) => `unapproved ${currency}${amount}`, + integrationSyncFailed: (label: string, errorMessage: string) => `failed to sync with ${label} ("${errorMessage}")`, }, }, }, diff --git a/src/pages/home/report/ReportActionItem.tsx b/src/pages/home/report/ReportActionItem.tsx index 68ced63d12d0..592dc8033461 100644 --- a/src/pages/home/report/ReportActionItem.tsx +++ b/src/pages/home/report/ReportActionItem.tsx @@ -666,6 +666,9 @@ function ReportActionItem({ newName: initialMessage?.newName ?? '', }); children = ; + } else if (ReportActionsUtils.isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.INTEGRATION_SYNC_FAILED)) { + const {label, errorMessage} = ReportActionsUtils.getOriginalMessage(action) ?? {label: '', errorMessage: ''}; + children = ; } else { const hasBeenFlagged = ![CONST.MODERATION.MODERATOR_DECISION_APPROVED, CONST.MODERATION.MODERATOR_DECISION_PENDING].some((item) => item === moderationDecision) && diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index e70629782e2a..381baf27a0f4 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -475,6 +475,20 @@ type OriginalMessageUnapproved = { */ type OriginalMessageAddPaymentCard = Record; +/** + * Original message for INTEGRATIONSYNCFAILED actions + */ +type OriginalMessageIntegrationSyncFailed = { + /** The user friendly connection name */ + label: string; + + /** The source of the connection sync */ + source: string; + + /** The error message from Integration Server */ + errorMessage: string; +}; + /** The map type of original message */ type OriginalMessageMap = { /** */ @@ -603,6 +617,8 @@ type OriginalMessageMap = { [CONST.REPORT.ACTIONS.TYPE.CARD_MISSING_ADDRESS]: never; /** */ [CONST.REPORT.ACTIONS.TYPE.CARD_ISSUED_VIRTUAL]: never; + /** */ + [CONST.REPORT.ACTIONS.TYPE.INTEGRATION_SYNC_FAILED]: OriginalMessageIntegrationSyncFailed; } & OldDotOriginalMessageMap & { [T in ValueOf]: OriginalMessageChangeLog; } & { From f7746ea778ab482cc40d9a998bed41a2c4d8a7a4 Mon Sep 17 00:00:00 2001 From: Andrew Rosiclair Date: Mon, 19 Aug 2024 16:20:40 -0400 Subject: [PATCH 2/3] add espanol translation --- src/languages/es.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/languages/es.ts b/src/languages/es.ts index 877783a84725..24ce474d7d05 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -3900,6 +3900,7 @@ export default { stripePaid: ({amount, currency}: StripePaidParams) => `pagado ${currency}${amount}`, takeControl: `tomó el control`, unapproved: ({amount, currency}: UnapprovedParams) => `no aprobado ${currency}${amount}`, + integrationSyncFailed: (label: string, errorMessage: string) => `no se pudo sincronizar con ${label} ("${errorMessage}")`, addEmployee: (email: string, role: string) => `agregó a ${email} como ${role === 'user' ? 'miembro' : 'administrador'}`, updateRole: (email: string, currentRole: string, newRole: string) => `actualicé el rol ${email} de ${currentRole === 'user' ? 'miembro' : 'administrador'} a ${newRole === 'user' ? 'miembro' : 'administrador'}`, From b834bc3a3cc34a42e7635f50756cd6d57bae39c9 Mon Sep 17 00:00:00 2001 From: Andrew Rosiclair Date: Wed, 21 Aug 2024 14:49:50 -0400 Subject: [PATCH 3/3] copy translated text for INTEGRATIONSYNCFAILED actions --- src/pages/home/report/ContextMenu/ContextMenuActions.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx index cfba04fee23c..004d446a744c 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx @@ -470,6 +470,9 @@ const ContextMenuActions: ContextMenuAction[] = [ setClipboardMessage(ReportActionsUtils.getPolicyChangeLogChangeRoleMessage(reportAction)); } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_EMPLOYEE) { setClipboardMessage(ReportActionsUtils.getPolicyChangeLogDeleteMemberMessage(reportAction)); + } else if (ReportActionsUtils.isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.INTEGRATION_SYNC_FAILED)) { + const {label, errorMessage} = ReportActionsUtils.getOriginalMessage(reportAction) ?? {label: '', errorMessage: ''}; + setClipboardMessage(Localize.translateLocal('report.actions.type.integrationSyncFailed', label, errorMessage)); } else if (content) { setClipboardMessage( content.replace(/()(.*?)(<\/mention-user>)/gi, (match, openTag: string, innerContent: string, closeTag: string): string => {