Skip to content

Commit

Permalink
Merge pull request #47398 from Expensify/youssef_fix_ui_allowing_edit…
Browse files Browse the repository at this point in the history
…s_for_paid_reports

Fix UI allowing edits by submitters to paid reports in Control
  • Loading branch information
neil-marcellini authored Aug 15, 2024
2 parents c849fbb + de2ccc0 commit ad2ff21
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 @@ -2926,8 +2926,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 @@ -2943,7 +2944,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 ad2ff21

Please sign in to comment.