Skip to content

Show For you approval to-dos for manually forwarded admins#95633

Open
ishpaul777 wants to merge 3 commits into
Expensify:mainfrom
ishpaul777:ishpaul/fix-foryou-approve-manual-forward
Open

Show For you approval to-dos for manually forwarded admins#95633
ishpaul777 wants to merge 3 commits into
Expensify:mainfrom
ishpaul777:ishpaul/fix-foryou-approve-manual-forward

Conversation

@ishpaul777

@ishpaul777 ishpaul777 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

The Home > For you section is populated by useTodoCounts, which classifies whatever reports are already in live Onyx. Those reports only get hydrated on the Home page when useYourSpendData fires the corresponding suggested search, and the Approve search only fires when getSuggestedSearchesVisibility marks it visible.

The approve visibility gate (isEligibleForApproveSuggestion) was purely workflow-based:

isApprovalEnabled && (isApprover || isSubmittedToTarget)

A workspace admin who is manually forwarded a report (outside the approval workflow) is neither isApprover nor a submitsTo/forwardsTo target, so the Approve search never fired, the report was never loaded into Onyx, and nothing showed under For you (or the Spend "Needs approval" view). Under workflow enforcement only an admin can manually forward/reassign an approver, so this exclusively affects admins.

Fix: extend the gate to also surface the Approve suggestion for admins. The Approve query itself is still scoped to reports where managerID is the current user, so admins with nothing to approve see no tile (the For you tile is count-gated by useTodoCounts).

isApprovalEnabled && (isApprover || isSubmittedToTarget || isAdmin)

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/657176
PROPOSAL:

Tests

  1. Create a paid workspace with Approvals enabled and Workflows / approval workflow on.
  2. Add 3 members:
  3. Submitter (User)
  4. Workflow Approver (User or Admin) - set as the workspace approver / submitsTo target
  5. Outsider Admin - Admin role, butnotthe workspace approver andnotanyone's submitsTo/forwardsTo
  6. As Submitter: create an expense on that workspace and submit it (it should go to Workflow Approver).
  7. As Workflow Approver: open the report → Change approver / Reassign → pick Outsider Admin.
    Important: log out. Log in as Outsider Admin on afresh session. Go toHomefirst. Donotopen the report from chat/search before checking Home.
  • Verify that no errors appear in the JS console

Offline tests

This is a client-side visibility change with no offline-specific behavior. Suggested searches are computed from already-synced policy data, so results match the online behavior once policies are cached.

QA Steps

Same as Tests above.

  • 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 any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • 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 any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • 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

Screenshot 2026-07-08 at 10 18 22 PM

Surface the approve suggested search for workspace admins even when they
are not part of the approval workflow, so reports manually forwarded to
them appear under Home > For you and the Spend "Needs approval" view.
@ishpaul777 ishpaul777 requested review from a team as code owners July 8, 2026 16:43
@melvin-bot melvin-bot Bot requested review from rojiphil and removed request for a team July 8, 2026 16:43
@melvin-bot

melvin-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown

@rojiphil 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 requested review from joekaufmanexpensify and removed request for a team July 8, 2026 16:43
@ishpaul777 ishpaul777 requested a review from mountiny July 8, 2026 16:49
Build the test policies via createRandomPolicy instead of unsafe type
assertions so the file stays within the eslint no-unsafe-type-assertion
seatbelt.
@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/libs/SearchUIUtils.ts 62.87% <100.00%> (ø)
... and 15 files with indirect coverage changes

@joekaufmanexpensify joekaufmanexpensify 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.

Good for product

@rojiphil

rojiphil commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Have the submitter submit an expense report, then (as an admin) manually forward/reassign that report's approver to the out-of-workflow admin.

@ishpaul777 I am unable to reproduce the customer's issue where Spend does not show Needs Approval but reports are pending for approval.

Below is a test video for this.
The actors in the test video are: Roji_T973 (Owner of Workspace), Roji_T975(Submitter), Roji_T976 (Workspace Admin + Approver), Roji_T974 (Workspace Admin)
When Roji_T976(Workspace Admin+Approver) reassigns the report's approver to Roji_T974(another Workspace Admin), the staging version shows the Needs Approval and Home->For you with report but the customer-provided screenshot does not show Needs Approval.

What am I missing here in the reproduction steps? Or did I misunderstand the term manually forward/reassign?

95633-manual-forward-001.mp4

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants