Skip to content

Commit

Permalink
Merge pull request Expensify#52093 from daledah/fix/51130
Browse files Browse the repository at this point in the history
  • Loading branch information
cead22 authored Dec 10, 2024
2 parents d31f259 + fb5915e commit 499079b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/libs/actions/Policy/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,14 +315,17 @@ function deleteWorkspace(policyID: string, policyName: string) {
const currentTime = DateUtils.getDBTime();
reportsToArchive.forEach((report) => {
const {reportID, ownerAccountID} = report ?? {};
const isInvoiceReceiverReport = report?.invoiceReceiver && 'policyID' in report.invoiceReceiver && report.invoiceReceiver.policyID === policyID;
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`,
value: {
stateNum: CONST.REPORT.STATE_NUM.APPROVED,
statusNum: CONST.REPORT.STATUS_NUM.CLOSED,
oldPolicyName: allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${policyID}`]?.name ?? '',
policyName: '',
...(!isInvoiceReceiverReport && {
oldPolicyName: allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${policyID}`]?.name ?? '',
policyName: '',
}),
// eslint-disable-next-line @typescript-eslint/naming-convention
private_isArchived: currentTime,
},
Expand Down

0 comments on commit 499079b

Please sign in to comment.