From fb799a6cb45eda5e7ec1426ff777771c8fbba02e Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Mon, 30 Sep 2024 17:25:28 +0700 Subject: [PATCH] fix lint and add failureData --- src/libs/actions/Report.ts | 12 +++++++++--- src/types/onyx/OriginalMessage.ts | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 9894cadc0949..f6d1ea588aec 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -3889,7 +3889,7 @@ function resolveActionableReportMentionWhisper( }, }, }; - + const reportUpdateDataWithPreviousLastMessage = ReportUtils.getReportLastMessage(reportId, optimisticReportActions as ReportActions); const report = ReportConnection.getAllReports()?.[`${ONYXKEYS.COLLECTION.REPORT}${reportId}`]; @@ -3943,8 +3943,8 @@ function resolveActionableReportMentionWhisper( const reportIDList = []; if (resolution === CONST.REPORT.ACTIONABLE_REPORT_MENTION_WHISPER_RESOLUTION.CREATE) { - const originalMessage = reportAction.originalMessage as OriginalMessage<'ACTIONABLEREPORTMENTIONWHISPER'>; - originalMessage.reportNames?.map((roomName: string) => { + const originalMessage = ReportActionsUtils.getOriginalMessage(reportAction as ReportAction); + originalMessage?.reportNames?.forEach((roomName: string) => { const optimisticRoom = ReportUtils.buildOptimisticChatReport( report?.participantAccountIDs ?? [], roomName, @@ -3970,6 +3970,12 @@ function resolveActionableReportMentionWhisper( value: {[optimisticCreatedAction.reportActionID]: optimisticCreatedAction}, }); + failureData.push({ + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${optimisticRoom.reportID}`, + value: {[optimisticCreatedAction.reportActionID]: null}, + }); + optimisticData.push({ onyxMethod: Onyx.METHOD.SET, key: `${ONYXKEYS.COLLECTION.REPORT}${optimisticRoom.reportID}`, diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index 12b0366ca1ed..6304910254f4 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -146,6 +146,7 @@ type OriginalMessageActionableReportMentionWhisper = { /** Collection of accountIDs of users mentioned in message */ whisperedTo?: number[]; + /** List name of the room */ reportNames?: string[]; };