Skip to content

[Due for payment 2026-10-16] [$175] Reports- preview Disabled submit button not displayed to prevent self-approval wp #100709

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.4.74-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #97946
Email or phone of affected tester (no customers): applausetester+dk45@applause.expensifail.com
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Windows 11 Home/Chrome
App Component: Money Requests

Action Performed:

  1. Open https://staging.new.expensify.com/
  2. Go to Workspace settings
  3. Enable 'Prevent self-approvals'
  4. Go to workspace chat
  5. Create an expense report

Expected Result:

verify the preview Submit button is disabled

Actual Result:

The disabled submit button is not displayed in preview report

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome Safari

Screenshots/Videos

Bug7254708_1788923759675.bandicam_2026-09-09_10-12-24-533.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Nathan Lemma
Bug ID: 7254708

Issue OwnerCurrent Issue Owner: @thelullabyy
Upwork Automation - Do Not Edit

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Sep 9, 2026
  2. applause-bot commented on Sep 9, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/382126e64fc48b24fc9274370557986caa27115a9184ed1d37d07244fd730702

  3. MelvinBot commented on Sep 9, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    The report preview never renders a Submit button in this state, so there is nothing to disable. The two Submit surfaces resolve their action differently:

    This makes the gate added by #97946 (SubmitActionButton.tsx:124-133, isDisabled at L195) unreachable for the prevent-self-approval branch — the component is never mounted. Its unit test mocks shouldBlockSubmitDueToPreventSelfApproval, so it passes while the real app skips the component, which is why this only surfaced in QA.

    Why the underlying "block submission" condition really is true here

    shouldBlockSubmitDueToPreventSelfApproval (ReportUtils.ts:10102-10111) compares getNextApproverAccountID(report) against report.ownerAccountID. With a self-approval workspace, getApprovalChain pops the owner from the chain when preventSelfApproval is set, leaving it empty, so getNextApproverAccountID falls back to getSubmitToAccountID = the owner. Both gates agree the submission is blocked; they only disagree on whether to hide or disable the button.

    Verification note: I could not reproduce the blocked state at runtime — "Prevent self-approvals" is behind the Control-plan upgrade paywall on a test workspace, and the test account is on Collect. With the setting off I confirmed the control case: preview card and report header both show an enabled Submit. The root cause above rests on code evidence, not a live repro.

    What changes do you think we should make in order to solve the problem?

    Align canSubmit with the header's isSubmitAction: in ReportPreviewActionUtils.ts:76, add the !isSubmitter qualifier (the local isSubmitter is already computed at L57) so the early return only applies to non-submitters.

    The preview action then resolves to SUBMIT for the submitter, SubmitActionButton mounts, and the isDisabled gate from #97946 renders it disabled — matching the header and the documented expected result. No change to SubmitActionButton is needed.

    Add a unit test for canSubmit/getReportPreviewAction covering preventSelfApproval + submitter → SUBMIT (there is currently no test file for ReportPreviewActionUtils), so the preview and header gates cannot drift apart again.

    What alternative solutions did you explore? (Optional)

    Treat the preview's current hide-the-button behavior as intended and correct the QA/test plan instead. That still leaves the header showing a disabled Submit while the preview shows no Submit for the same report, so a product decision is needed either way. Hiding-vs-disabling parity should be settled before the fix lands.

    Related issues


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/100709) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.


    view run · no recording available

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Sep 9, 2026
  5. melvin-bot commented on Sep 9, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @thelullabyy (External)

  6. melvin-bot commented on Sep 9, 2026

    @melvin-bot

    Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.

  7. melvin-bot commented on Sep 14, 2026

    @melvin-bot

    @thelullabyy Huh... This is 4 days overdue. Who can take care of this?

  8. thelullabyy commented on Sep 15, 2026

    @thelullabyy
    Contributor

    @MelvinBot please draft a PR for me to test your suggestions

  9. MelvinBot commented on Sep 15, 2026

    @MelvinBot
    Contributor

    🤖 Draft PR created: #101148

    Please mark it as "Ready for review" when it's ready.

    What changed: one line in src/libs/ReportPreviewActionUtils.ts:76 — canSubmit now qualifies the prevent-self-approval early return with !isSubmitter, matching isSubmitAction in the report header. The preview action resolves to SUBMIT for the submitter, SubmitActionButton mounts, and the isDisabled gate from #97946 renders it disabled. No change to SubmitActionButton was needed.

    Regression tests: two cases added to tests/actions/ReportPreviewActionUtilsTest.ts — submitter expects SUBMIT, non-submitter expects not SUBMIT. I confirmed the first one fails on main and passes with the fix, so it's a real guard rather than a passing no-op.

    Checks I ran locally
    Check Result
    npm run lint-changed ✅ pass
    npm run typecheck ✅ pass
    npm run spell-changed ✅ pass
    npm test — ReportPreviewActionUtilsTest, ReportPrimaryActionUtilsTest, MoneyRequestReportPreview, ReportPreviewActionButtonTest, SubmitActionButtonTest, useReportPreviewActionDecisionTest, ReportWorkflowTest ✅ 260 passed

    Not applicable: npm run prettier (no such script here — ESLint enforces formatting), the React Compiler check (no .tsx changed), the Storybook smoke test (no component changed).

    One correction to my earlier proposal: I said there was no test file for ReportPreviewActionUtils. There is — tests/actions/ReportPreviewActionUtilsTest.ts — so the new cases went there instead of into a new file.

    Two things to confirm before merging:

    1. I could not verify this in a browser. The automated web session for this run was stuck on a blank page and couldn't be driven, so the fix rests on unit-test and code evidence, not a live repro. Please confirm the disabled button visually when you test.
    2. The hide-vs-disable question is still open. This PR makes the preview match the header, which is what the issue's expected result describes. If the intended product behavior is actually to hide Submit in both places, the header needs the change instead and this PR should be rejected.

    The PR is on an upstream branch since I can't push to your fork — #101148 has the commands to copy it over if you'd rather own it from there.


    view run · no recording available

  10. thelullabyy commented on Sep 18, 2026

    @thelullabyy
    Contributor

    Reviewing...

  11. 12 remaining items

  12. changed the title [-]Reports- preview Disabled submit button not displayed to prevent self-approval wp[/-] [+][$175] Reports- preview Disabled submit button not displayed to prevent self-approval wp[/+] on Oct 7, 2026
  13. melvin-bot commented on Oct 7, 2026

    @melvin-bot
  14. haonnedu commented on Oct 7, 2026

    @haonnedu

    Hi, I noticed the Upwork job was just posted, but this issue already has PR #101148 under review. Is this job still open to new contributors, or is it for the existing implementation?

  15. melvin-bot commented on Oct 7, 2026

    @melvin-bot

    📣 @haonnedu! 📣
    Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
    Please follow these steps:

    1. Make sure you've read and understood the contributing guidelines.
    2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
    3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
    4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
      Screen Shot 2022-11-16 at 4 42 54 PM
      Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
    
  16. haonnedu commented on Oct 7, 2026

    @haonnedu

    Contributor details
    Your Expensify account email: haonguyen.dev.work@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/haonn

  17. added and removed
    ReviewingHas a PR in review
    on Oct 9, 2026
  18. changed the title [-][$175] Reports- preview Disabled submit button not displayed to prevent self-approval wp[/-] [+][Due for payment 2026-10-16] [$175] Reports- preview Disabled submit button not displayed to prevent self-approval wp[/+] on Oct 9, 2026
  19. melvin-bot commented on Oct 9, 2026

    @melvin-bot

    @thelullabyy

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.5.6-6 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-10-16. 🎊

    The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the Contributor+ Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]. If no checklist is needed for this issue, you can click: [no checklist button]

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorOverdue

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions