Skip to content

Commit

Permalink
Merge pull request #37438 from Expensify/lucien/fix-workflows-autorep…
Browse files Browse the repository at this point in the history
…orting-switch

Fix Workflows switch button's state for delayed submission
  • Loading branch information
luacmartins authored Feb 28, 2024
2 parents b8e0989 + 928e445 commit fd16476
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/libs/actions/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,9 @@ function setWorkspaceAutoReporting(policyID: string, enabled: boolean) {
key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
value: {
autoReporting: enabled,
harvesting: {
enabled: true,
},
pendingFields: {isAutoApprovalEnabled: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE},
},
},
Expand All @@ -403,7 +406,7 @@ function setWorkspaceAutoReporting(policyID: string, enabled: boolean) {
key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
value: {
autoReporting: !enabled,
pendingFields: {isAutoApprovalEnabled: null},
pendingFields: {isAutoApprovalEnabled: null, harvesting: null},
},
},
];
Expand All @@ -413,7 +416,7 @@ function setWorkspaceAutoReporting(policyID: string, enabled: boolean) {
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`,
value: {
pendingFields: {isAutoApprovalEnabled: null},
pendingFields: {isAutoApprovalEnabled: null, harvesting: null},
},
},
];
Expand Down

0 comments on commit fd16476

Please sign in to comment.