Skip to content

Commit

Permalink
Merge pull request #49759 from Expensify/Rory-NoFailureDataFor460
Browse files Browse the repository at this point in the history
Don't apply failure data for 460 jsonCode
  • Loading branch information
roryabraham authored Sep 27, 2024
2 parents 73d3486 + 0fa776a commit b6b559d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 8 additions & 0 deletions src/libs/actions/OnyxUpdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ function applyHTTPSOnyxUpdates(request: Request, response: Response) {
return updateHandler(request.successData);
}
if (response.jsonCode !== 200 && request.failureData) {
// 460 jsonCode in Expensify world means "admin required".
// Typically, this would only happen if a user attempts an API command that requires policy admin access when they aren't an admin.
// In this case, we don't want to apply failureData because it will likely result in a RedBrickRoad error on a policy field which is not accessible.
// Meaning that there's a red dot you can't dismiss.
if (response.jsonCode === 460) {
Log.info('[OnyxUpdateManager] Received 460 status code, not applying failure data');
return Promise.resolve();
}
return updateHandler(request.failureData);
}
return Promise.resolve();
Expand Down
6 changes: 1 addition & 5 deletions src/pages/workspace/workflows/WorkspaceWorkflowsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,10 @@ function WorkspaceWorkflowsPage({policy, route}: WorkspaceWorkflowsPageProps) {
}, [policy, route.params.policyID, availableMembers, usedApproverEmails]);

const optionItems: ToggleSettingOptionRowProps[] = useMemo(() => {
const {accountNumber, addressName, bankName, bankAccountID} = policy?.achAccount ?? {};
const {addressName, bankName, bankAccountID} = policy?.achAccount ?? {};
const shouldShowBankAccount = !!bankAccountID && policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_YES;
const bankIcon = getBankIcon({bankName: bankName as BankName, isCard: false, styles});

let bankDisplayName = bankName ?? addressName;
if (accountNumber && bankDisplayName !== accountNumber) {
bankDisplayName += ` ${accountNumber.slice(-5)}`;
}
const hasReimburserError = !!policy?.errorFields?.reimburser;
const hasApprovalError = !!policy?.errorFields?.approvalMode;
const hasDelayedSubmissionError = !!policy?.errorFields?.autoReporting ?? !!policy?.errorFields?.autoReportingFrequency;
Expand Down

0 comments on commit b6b559d

Please sign in to comment.