Skip to content

Commit

Permalink
Fix missing condition
Browse files Browse the repository at this point in the history
  • Loading branch information
youssef-lr committed Aug 14, 2024
1 parent a2552be commit de2ccc0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2889,8 +2889,9 @@ function canEditMoneyRequest(reportAction: OnyxInputOrEntry<ReportAction<typeof
const moneyRequestReport = getReportOrDraftReport(String(moneyRequestReportID));
const isRequestor = currentUserAccountID === reportAction?.actorAccountID;

const isSubmitted = isProcessingReport(moneyRequestReport);
if (isIOUReport(moneyRequestReport)) {
return isProcessingReport(moneyRequestReport) && isRequestor;
return isSubmitted && isRequestor;
}

const policy = getPolicy(moneyRequestReport?.policyID ?? '-1');
Expand All @@ -2906,7 +2907,7 @@ function canEditMoneyRequest(reportAction: OnyxInputOrEntry<ReportAction<typeof
return true;
}

if (policy?.type === CONST.POLICY.TYPE.CORPORATE && moneyRequestReport && isCurrentUserSubmitter(moneyRequestReport.reportID)) {
if (policy?.type === CONST.POLICY.TYPE.CORPORATE && moneyRequestReport && isSubmitted && isCurrentUserSubmitter(moneyRequestReport.reportID)) {
const isForwarded = PolicyUtils.getSubmitToAccountID(policy, moneyRequestReport.ownerAccountID ?? 0) !== moneyRequestReport.managerID;
return !isForwarded;
}
Expand Down

0 comments on commit de2ccc0

Please sign in to comment.