Skip to content

Commit

Permalink
fix lint and add failureData
Browse files Browse the repository at this point in the history
  • Loading branch information
nkdengineer committed Sep 30, 2024
1 parent 2f89133 commit fb799a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3889,7 +3889,7 @@ function resolveActionableReportMentionWhisper(
},
},
};

const reportUpdateDataWithPreviousLastMessage = ReportUtils.getReportLastMessage(reportId, optimisticReportActions as ReportActions);

const report = ReportConnection.getAllReports()?.[`${ONYXKEYS.COLLECTION.REPORT}${reportId}`];
Expand Down Expand Up @@ -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<typeof CONST.REPORT.ACTIONS.TYPE.ACTIONABLE_REPORT_MENTION_WHISPER>);
originalMessage?.reportNames?.forEach((roomName: string) => {
const optimisticRoom = ReportUtils.buildOptimisticChatReport(
report?.participantAccountIDs ?? [],
roomName,
Expand All @@ -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}`,
Expand Down
1 change: 1 addition & 0 deletions src/types/onyx/OriginalMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ type OriginalMessageActionableReportMentionWhisper = {
/** Collection of accountIDs of users mentioned in message */
whisperedTo?: number[];

/** List name of the room */
reportNames?: string[];
};

Expand Down

0 comments on commit fb799a6

Please sign in to comment.