Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/libs/ReportPreviewActionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ function canSubmit(
const isExpense = isExpenseReport(report);
const isSubmitter = isCurrentUserSubmitter(report);
const isOpen = isOpenReport(report);
const submitToAccountID = getSubmitToAccountID(policy, report);
const isManager = submitToAccountID === currentUserAccountID || report.managerID === currentUserAccountID;
const isManager = report.managerID === currentUserAccountID;
const isAdmin = policy?.role === CONST.POLICY.ROLE.ADMIN;
Comment on lines 37 to 41

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat rule-based approver as manager for preview submit

By limiting isManager to report.managerID, canSubmit no longer recognizes the policy-derived approver (getSubmitToAccountID) when that value differs from the report’s stored managerID (e.g., rule-based approvers or reports whose managerID hasn’t been updated yet while still open). In those cases the actual approver won’t pass the manager check and the report preview won’t show the Submit action, which matches the missing submit button regression that getSubmitToAccountID was previously covering.

Useful? React with 👍 / 👎.


if (!!transactions && transactions?.length > 0 && transactions.every((transaction) => isPending(transaction))) {
Expand All @@ -51,6 +50,8 @@ function canSubmit(
return false;
}

const submitToAccountID = getSubmitToAccountID(policy, report);

if (submitToAccountID === report.ownerAccountID && policy?.preventSelfApproval) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ReportSecondaryActionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ function isSubmitAction({

const isReportSubmitter = isCurrentUserSubmitter(report);
const isAdmin = policy?.role === CONST.POLICY.ROLE.ADMIN;
const isManager = getSubmitToAccountID(policy, report) === currentUserAccountID || report.managerID === currentUserAccountID;
const isManager = report.managerID === getCurrentUserAccountID();
if (!isReportSubmitter && !isAdmin && !isManager) {
Comment on lines 217 to 220

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Secondary submit action ignores policy approver

The secondary action flow now treats only report.managerID as the manager. If the submit target is computed via getSubmitToAccountID (rule-based approvers, or when managerID is stale on an open report), the designated approver will fail the manager check and the Submit option won’t appear in the secondary actions menu, even though they are the current approver for that report.

Useful? React with 👍 / 👎.

return false;
}
Expand Down
Loading