Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix - Expense-Thread message for hold expense not shown in offline #49866

Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7843,6 +7843,8 @@ function putOnHold(transactionID: string, comment: string, reportID: string, sea
const newViolation = {name: CONST.VIOLATIONS.HOLD, type: CONST.VIOLATION_TYPES.VIOLATION};
const transactionViolations = allTransactionViolations[`${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`] ?? [];
const updatedViolations = [...transactionViolations, newViolation];
const parentReportActionOptimistic = ReportUtils.getOptimisticDataForParentReportAction(reportID, createdReportActionComment.created, CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD);

const optimisticData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
Expand All @@ -7852,6 +7854,13 @@ function putOnHold(transactionID: string, comment: string, reportID: string, sea
[createdReportActionComment.reportActionID]: createdReportActionComment as ReportAction,
},
},
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
value: {
lastVisibleActionCreated: createdReportActionComment.created,
FitseTLT marked this conversation as resolved.
Show resolved Hide resolved
},
},
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`,
Expand All @@ -7869,6 +7878,13 @@ function putOnHold(transactionID: string, comment: string, reportID: string, sea
},
];

parentReportActionOptimistic.forEach((parentActionData) => {
if (!parentActionData) {
return;
}
optimisticData.push(parentActionData);
});

const successData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
Expand Down Expand Up @@ -7948,6 +7964,13 @@ function unholdRequest(transactionID: string, reportID: string, searchHash?: num
[createdReportAction.reportActionID]: createdReportAction as ReportAction,
},
},
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
value: {
lastVisibleActionCreated: createdReportAction.created,
},
},
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`,
Expand Down
Loading