Skip to content

[Payment due @marufsharifi] [CP Staging] Stop nudging approvers to submit reports#96741

Merged
mountiny merged 6 commits into
Expensify:mainfrom
rushatgabhane:gray-submit-approver
Jul 22, 2026
Merged

[Payment due @marufsharifi] [CP Staging] Stop nudging approvers to submit reports#96741
mountiny merged 6 commits into
Expensify:mainfrom
rushatgabhane:gray-submit-approver

Conversation

@rushatgabhane

@rushatgabhane rushatgabhane commented Jul 22, 2026

Copy link
Copy Markdown
Member

Explanation of Change

Slack: https://expensify.slack.com/archives/C07HPDRELLD/p1784685321619489

Submit is the primary CTA only for the report owner. For an approver viewing a draft they don't own, force-submitting is a secondary action, so:

  • Header: Submit moves under the More menu instead of the green primary button.
  • Report preview: shows View instead of the Submit button.

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/662756

PROPOSAL:

Tests

  1. On a workspace with approvals, create an expense on a new report as an employee and leave it an open draft.
  2. Sign in as that employee's approver (not the owner).
  3. Verify the report header shows Submit under More (not the green primary button).
  4. Verify the report preview in the workspace chat shows a View button (not Submit).
  5. Sign in as the owner and verify the header shows the green primary Submit and the preview shows the Submit button.
  • Verify that no errors appear in the JS console

Offline tests

Submit action visibility is computed locally from Onyx data, so the behavior is identical offline.

  1. Repeat the Tests steps while offline and verify the same results.

QA Steps

  1. Same as Tests.
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-07-22.at.16.56.38.mov

@rushatgabhane
rushatgabhane requested review from a team as code owners July 22, 2026 13:29
@melvin-bot
melvin-bot Bot requested review from heyjennahay and thesahindia and removed request for a team July 22, 2026 13:29
@melvin-bot

melvin-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

@thesahindia Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot
melvin-bot Bot removed the request for review from a team July 22, 2026 13:29
Comment thread src/libs/ReportPrimaryActionUtils.ts Outdated
@rushatgabhane rushatgabhane added the CP Staging marks PRs that have been CP'd to staging label Jul 22, 2026
@rushatgabhane

Copy link
Copy Markdown
Member Author

asked for an urgent review since this fixes a DB

@trjExpensify
trjExpensify requested review from trjExpensify and removed request for heyjennahay July 22, 2026 14:09
trjExpensify
trjExpensify previously approved these changes Jul 22, 2026

@trjExpensify trjExpensify left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for jumping on this, @rushatgabhane.

@trjExpensify

Copy link
Copy Markdown
Contributor

@mountiny I think we should CP this as this PR identified yesterday should ideally have rectified this blocker as well. 👍

@marufsharifi

marufsharifi commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Screen.Recording.2026-07-22.at.8.34.23.PM.mov
Android: mWeb Chrome
Recording_20260722_193230.mp4
iOS: HybridApp
iOS: mWeb Safari
Screen.Recording.2026-07-22.at.8.23.52.PM.mov
MacOS: Chrome / Safari
Screencast.From.2026-07-22.17-35-32.webm

@marufsharifi marufsharifi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good overall! I just have a few minor suggestions for your consideration.

Comment thread src/libs/ReportPrimaryActionUtils.ts
Comment thread tests/actions/ReportPreviewActionUtilsTest.ts Outdated
isChatReportArchived: false,
}),
).toBe(CONST.REPORT.PRIMARY_ACTIONS.SUBMIT);
).toBe('');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

'' is the genuine "no primary action" sentinel returned by getReportPrimaryAction, so this assertion is consistent with the source — 👍.

Optional: to lock both directions of this change, consider adding a sibling case asserting the owner still gets CONST.REPORT.PRIMARY_ACTIONS.SUBMIT on the same OPEN report, right next to this one. That guards against a future edit to the shared isSubmitAction silently breaking the owner path.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

sorry, i don't understand what you mean by the optional case

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No worries, let me be concrete.

Your changed test proves the negative direction: a workflow approver who doesn't own the report gets '' (no primary Submit). What it doesn't prove is that the same setup still gives the owner a Submit — i.e. that the new isCurrentUserSubmitter(...) guard discriminates by owner rather than just switching Submit off for everyone in an advanced-approval policy.

"Sibling case" just meant a second it(...) right after this one, reusing this exact fixture but flipping the current user to be the owner, asserting SUBMIT:

it('should return SUBMIT as the primary action for the owner of an OPEN expense report', async () => {
    // same policy/report setup as the test above, but current user IS the owner
    const report = createMock<Report>({
        reportID: REPORT_ID,
        type: CONST.REPORT.TYPE.EXPENSE,
        ownerAccountID: CURRENT_USER_ACCOUNT_ID, // <- owner is the current user
        stateNum: CONST.REPORT.STATE_NUM.OPEN,
        statusNum: CONST.REPORT.STATUS_NUM.OPEN,
    });
    // ...same advanced-approval policy + transaction as the approver test...
    expect(getReportPrimaryAction({ /* ...same params... */ }))
        .toBe(CONST.REPORT.PRIMARY_ACTIONS.SUBMIT);
});

The value is regression protection: if someone later inverts the guard or edits the shared isSubmitAction, the negative test alone wouldn't catch the owner losing Submit — the positive one would.

That said — feel free to skip it. I just noticed the file already has 'should return SUBMIT for open report in instant submit policy with no approvers' (and the one above it) covering the owner→SUBMIT direction, so the positive path isn't unguarded. The only thing a sibling would add is coverage of that direction within the advanced-approval fixture specifically, which is marginal. Non-blocking either way.

@rushatgabhane rushatgabhane Jul 22, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

same setup still gives the owner a Submit

but we already have tests for submitter should see Submit button. like, it won't cover more functions. if test breaks for advanced approval, they will break for instant submit too

@rushatgabhane rushatgabhane changed the title Gray Submit for approvers on drafts they don't own [CP Staging] Stop nudging approvers to submit reports Jul 22, 2026
@mountiny
mountiny self-requested a review July 22, 2026 15:02
mountiny
mountiny previously approved these changes Jul 22, 2026
@luacmartins
luacmartins self-requested a review July 22, 2026 16:04

@marufsharifi marufsharifi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@melvin-bot melvin-bot Bot changed the title [CP Staging] Stop nudging approvers to submit reports [Payment due @marufsharifi] [CP Staging] Stop nudging approvers to submit reports Jul 22, 2026
@melvin-bot

melvin-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

🎯 @marufsharifi, thanks for reviewing and testing this PR! 🎉

A payment issue will be created for your review once this PR is deployed to production.
E/E issue linked to the PR - https://www.github.com/Expensify/Expensify/issues/662756.

If payment is not needed (e.g., regression PR review fix etc), react with 👎 to this comment to prevent the payment issue from being created.

@mountiny
mountiny merged commit 5fba1a0 into Expensify:main Jul 22, 2026
36 checks passed
OSBotify pushed a commit that referenced this pull request Jul 22, 2026
[Payment due @marufsharifi] [CP Staging] Stop nudging approvers to submit reports

(cherry picked from commit 5fba1a0)

(cherry-picked to staging by mountiny)
@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Cherry-picked to staging by https://github.com/mountiny in version: 9.4.42-1 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 I reviewed this PR against the help site articles under docs/articles and no help site changes are required.

Why: This change only adjusts where the Submit action surfaces for a non-owner approver viewing a draft report:

  • Header: Submit moves under the grey More menu instead of being the green primary button.
  • Report preview: shows View instead of the Submit button.

Submit remains the green primary action for the report owner/submitter.

I checked the two articles that document report actions:

Both already describe Submit as the Submitter's primary action (the "Primary report actions" table lists Submit → Draft reports → Submitter), and neither documents the previous behavior of approvers being shown a primary Submit button. This PR aligns the UI with what the help site already says. The report-preview button distinction (Submit vs. View) isn't documented at that granularity, so nothing there needs updating either.

Since there are no user-facing documented behaviors that this change contradicts, I did not open a docs PR (so there's no linked help site PR to review).

@rushatgabhane, if you'd prefer to explicitly document that a non-owner approver can still force-submit from the More menu, reply and I'll draft that addition as a HelpDot draft PR.

@github-actions

Copy link
Copy Markdown
Contributor

🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here.

@melvin-bot

melvin-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

🤖 Payment issue created: #96790

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.4.42-1 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Cherry-picked to staging by https://github.com/mountiny in version: 9.4.43-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 I reviewed this PR against the help site articles under docs/articles and no help site changes are required.

Why: This change refines where the Submit action appears for a workflow approver viewing a draft report they don't own — moving it from the green primary button / report-preview Submit button to the More menu (header) and View (preview). It doesn't change any documented, user-facing capability.

The relevant articles already describe Submit as fundamentally a submitter action, with force-submit available as a secondary action via More — which is exactly what this PR now enforces:

  • Understanding-Report-Statuses-and-Actions.md — documents "Green Button = Primary Action" (Submit/Approve/Pay/Export) vs. "Grey More button = More Actions," and already notes that when no green button appears you tap More for available options.
  • Expense-and-Report-Actions.md — lists Submit as a primary action for the Submitter and as a More-menu action ("Submitter, Admin on behalf of submitter"), and lists View as the "no further action required / view-only" state.

None of the articles document the previous behavior of nudging a non-owner approver with a primary Submit button, so there's nothing to correct. The generic descriptions of the primary vs. More buttons remain accurate after this change.

Since no changes are needed, I did not open a draft docs PR.

@rushatgabhane, please confirm you agree no help site update is needed here. If you'd like me to document approver-specific force-submit behavior explicitly (e.g., in Expense-and-Report-Actions.md), reply and I'll draft that PR.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.4.43-1 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CP Staging marks PRs that have been CP'd to staging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants