-
Notifications
You must be signed in to change notification settings - Fork 3.7k
fix: "On Hold" status is not removed after expense is moved to Self DM #70593
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -19,6 +19,7 @@ | |||||||||||||||||
| buildOptimisticDismissedViolationReportAction, | ||||||||||||||||||
| buildOptimisticMovedTransactionAction, | ||||||||||||||||||
| buildOptimisticSelfDMReport, | ||||||||||||||||||
| buildOptimisticUnHoldReportAction, | ||||||||||||||||||
| buildOptimisticUnreportedTransactionAction, | ||||||||||||||||||
| buildTransactionThread, | ||||||||||||||||||
| findSelfDMReportID, | ||||||||||||||||||
|
|
@@ -50,13 +51,13 @@ | |||||||||||||||||
| import {getPolicyTagsData} from './Policy/Tag'; | ||||||||||||||||||
|
|
||||||||||||||||||
| let recentWaypoints: RecentWaypoint[] = []; | ||||||||||||||||||
| Onyx.connect({ | ||||||||||||||||||
| key: ONYXKEYS.NVP_RECENT_WAYPOINTS, | ||||||||||||||||||
| callback: (val) => (recentWaypoints = val ?? []), | ||||||||||||||||||
| }); | ||||||||||||||||||
|
|
||||||||||||||||||
| const allTransactions: Record<string, Transaction> = {}; | ||||||||||||||||||
| Onyx.connect({ | ||||||||||||||||||
| key: ONYXKEYS.COLLECTION.TRANSACTION, | ||||||||||||||||||
| callback: (transaction, key) => { | ||||||||||||||||||
| if (!key || !transaction) { | ||||||||||||||||||
|
|
@@ -68,7 +69,7 @@ | |||||||||||||||||
| }); | ||||||||||||||||||
|
|
||||||||||||||||||
| let allTransactionDrafts: OnyxCollection<Transaction> = {}; | ||||||||||||||||||
| Onyx.connect({ | ||||||||||||||||||
| key: ONYXKEYS.COLLECTION.TRANSACTION_DRAFT, | ||||||||||||||||||
| waitForCollectionCallback: true, | ||||||||||||||||||
| callback: (value) => { | ||||||||||||||||||
|
|
@@ -77,7 +78,7 @@ | |||||||||||||||||
| }); | ||||||||||||||||||
|
|
||||||||||||||||||
| let allReports: OnyxCollection<Report> = {}; | ||||||||||||||||||
| Onyx.connect({ | ||||||||||||||||||
| key: ONYXKEYS.COLLECTION.REPORT, | ||||||||||||||||||
| waitForCollectionCallback: true, | ||||||||||||||||||
| callback: (value) => { | ||||||||||||||||||
|
|
@@ -89,7 +90,7 @@ | |||||||||||||||||
| }); | ||||||||||||||||||
|
|
||||||||||||||||||
| const allTransactionViolation: OnyxCollection<TransactionViolation[]> = {}; | ||||||||||||||||||
| Onyx.connect({ | ||||||||||||||||||
| key: ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS, | ||||||||||||||||||
| callback: (transactionViolation, key) => { | ||||||||||||||||||
| if (!key || !transactionViolation) { | ||||||||||||||||||
|
|
@@ -101,7 +102,7 @@ | |||||||||||||||||
| }); | ||||||||||||||||||
|
|
||||||||||||||||||
| let allTransactionViolations: TransactionViolations = []; | ||||||||||||||||||
| Onyx.connect({ | ||||||||||||||||||
| key: ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS, | ||||||||||||||||||
| callback: (val) => (allTransactionViolations = val ?? []), | ||||||||||||||||||
| }); | ||||||||||||||||||
|
|
@@ -776,6 +777,9 @@ | |||||||||||||||||
| key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transaction.transactionID}`, | ||||||||||||||||||
| value: { | ||||||||||||||||||
| reportID, | ||||||||||||||||||
| comment: { | ||||||||||||||||||
| hold: null, | ||||||||||||||||||
| }, | ||||||||||||||||||
| }, | ||||||||||||||||||
| }); | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
@@ -792,6 +796,9 @@ | |||||||||||||||||
| key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transaction.transactionID}`, | ||||||||||||||||||
| value: { | ||||||||||||||||||
| reportID: transaction.reportID, | ||||||||||||||||||
| comment: { | ||||||||||||||||||
| hold: transaction.comment?.hold, | ||||||||||||||||||
| }, | ||||||||||||||||||
| }, | ||||||||||||||||||
| }); | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
@@ -1111,6 +1118,33 @@ | |||||||||||||||||
| } else { | ||||||||||||||||||
| transactionIDToReportActionAndThreadData[transaction.transactionID] = baseTransactionData; | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| // Build unhold report action | ||||||||||||||||||
| if (isOnHold(transaction)) { | ||||||||||||||||||
| const unHoldAction = buildOptimisticUnHoldReportAction(); | ||||||||||||||||||
| optimisticData.push({ | ||||||||||||||||||
| onyxMethod: Onyx.METHOD.MERGE, | ||||||||||||||||||
| key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadReportID}`, | ||||||||||||||||||
| value: {[unHoldAction.reportActionID]: unHoldAction}, | ||||||||||||||||||
| }); | ||||||||||||||||||
|
|
||||||||||||||||||
| successData.push({ | ||||||||||||||||||
| onyxMethod: Onyx.METHOD.MERGE, | ||||||||||||||||||
| key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadReportID}`, | ||||||||||||||||||
| value: {[unHoldAction.reportActionID]: {pendingAction: null}}, | ||||||||||||||||||
| }); | ||||||||||||||||||
|
|
||||||||||||||||||
| failureData.push({ | ||||||||||||||||||
| onyxMethod: Onyx.METHOD.MERGE, | ||||||||||||||||||
| key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadReportID}`, | ||||||||||||||||||
| value: {[unHoldAction.reportActionID]: null}, | ||||||||||||||||||
| }); | ||||||||||||||||||
|
|
||||||||||||||||||
| transactionIDToReportActionAndThreadData[transaction.transactionID] = { | ||||||||||||||||||
| ...transactionIDToReportActionAndThreadData[transaction.transactionID], | ||||||||||||||||||
| unholdReportActionID: unHoldAction.reportActionID, | ||||||||||||||||||
| }; | ||||||||||||||||||
| } | ||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @daledah if you implement the above changes, you should be all set to open this PR for review
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. c.c. @ahmedGaber93 for viz |
||||||||||||||||||
| }); | ||||||||||||||||||
|
|
||||||||||||||||||
| if (!transactionsMoved) { | ||||||||||||||||||
|
|
||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this caused
we should only add remove unhold message for unimported report