Skip to content

[Payment due @QichenZhu] Add Rejected search filter for expenses and expense reports - #103309

Merged
JS00001 merged 5 commits into
Expensify:mainfrom
c3024:chaitanya/685831-rejected-search-filter
Oct 16, 2026
Merged

JS00001 merged 5 commits into
Expensify:mainfrom
c3024:chaitanya/685831-rejected-search-filter

Conversation

@c3024

@c3024 c3024 commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

Adds a "Rejected" Yes/No filter for expenses and expense reports. The query key is declined:yes / declined:no. It works like Billable: filter list page, filter bar chip, typed query with autocomplete and negation.

Fixed Issues

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

Tests

  1. As a submitter on a workspace with approvals, submit three reports to an approver.
  2. As the approver, reject one expense on the first report.
  3. As the approver, reject the whole second report.
  4. As the submitter, go to Spend > Expenses and click Filters.
  5. Verify Rejected appears below Billable.
  6. Select Rejected > Yes.
  7. Verify a "Rejected: Yes" chip appears and only the rejected expense is listed.
  8. Change the chip to No.
  9. Verify the rejected expense is not listed and the other expenses are.
  10. Go to Spend > Reports and click Filters.
  11. Verify Rejected appears below Paid status.
  12. Select Rejected > Yes.
  13. Verify only the second report is listed.
  14. Click the search icon and type declined:.
  15. Verify the suggestions are declined:no and declined:yes.
  16. Search for type:expense -declined:yes.
  17. Verify the rejected expense is not listed.
  • Verify that no errors appear in the JS console

Offline tests

  1. Go offline.
  2. Click Filters on Spend > Expenses and select Rejected > Yes.
  3. Verify the "Rejected: Yes" chip appears.
  4. Go online.
  5. Verify the results load and show only rejected expenses.

QA Steps

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.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • 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 685831-stg-04-expenses-declined-no 685831-stg-05-admin-expenses-declined-yes 685831-stg-06-admin-reports-declined-yes 685831-stg-07-admin-reports-declined-no 685831-stg-08-admin-reports-negated-yes 685831-stg-09-admin-expenses-negated-no 685831-stg-10-autocomplete-key 685831-stg-11-autocomplete-values 685831-stg-12-router-declined-yes-result 685831-stg-13-submitter-expenses-all 685831-stg-14-submitter-expenses-declined-yes 685831-stg-15-submitter-expenses-declined-no 685831-stg-16-submitter-expenses-negated-yes 685831-stg-17-submitter-reports-declined-yes

@melvin-bot

melvin-bot Bot commented Oct 7, 2026

Copy link
Copy Markdown

Hey, I noticed you changed src/languages/en.ts in a PR from a fork. For security reasons, translations are not generated automatically for PRs from forks.

If you want to automatically generate translations for other locales, an Expensify employee will have to:

  1. Look at the code and make sure there are no malicious changes.
  2. Run the Generate static translations GitHub workflow. If you have write access and the K2 extension, you can simply click: [this button]

Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running:

npx bun ./scripts/generateTranslations.ts --help

Typically, you'd want to translate only what you changed by running npx bun ./scripts/generateTranslations.ts --compare-ref main

@codecov

codecov Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
src/CONST/index.ts 95.90% <ø> (ø)
...ents/Search/FilterComponents/ListFilterContent.tsx 10.52% <ø> (ø)
src/hooks/useAdvancedSearchFilters.ts 97.29% <ø> (ø)
src/hooks/useAutocompleteSuggestions.ts 73.07% <ø> (ø)
src/libs/SearchParser/autocompleteParser.js 59.93% <ø> (+0.10%) ⬆️
src/libs/SearchParser/searchParser.js 85.65% <ø> (+0.06%) ⬆️
src/libs/SearchQueryUtils.ts 91.01% <100.00%> (+0.13%) ⬆️
src/types/form/SearchAdvancedFiltersForm.ts 100.00% <ø> (ø)
src/libs/SearchAutocompleteUtils.ts 62.87% <0.00%> (-0.32%) ⬇️
src/libs/SearchUIUtils.ts 73.54% <87.50%> (+0.12%) ⬆️
... and 7 files with indirect coverage changes

…cted-search-filter

# Conflicts:
#	src/libs/SearchParser/autocompleteParser.js
#	src/libs/SearchParser/searchParser.js
@c3024
c3024 marked this pull request as ready for review October 15, 2026 09:57
@c3024
c3024 requested review from a team as code owners October 15, 2026 09:57
@melvin-bot
melvin-bot Bot requested review from QichenZhu and joekaufmanexpensify and removed request for a team October 15, 2026 09:57
@melvin-bot

melvin-bot Bot commented Oct 15, 2026

Copy link
Copy Markdown

@QichenZhu 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 October 15, 2026 09:57
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T18:08:15.563193Z b40435f New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fb243dfbfe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/libs/SearchUIUtils.ts Outdated
}

if (key === FILTER_KEYS.BILLABLE || key === FILTER_KEYS.REIMBURSABLE) {
if (key === FILTER_KEYS.BILLABLE || key === FILTER_KEYS.REIMBURSABLE || key === FILTER_KEYS.DECLINED) {

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 Translate negated Rejected filter values

When a user enters a negated query such as -declined:yes, buildFilterFormValuesFromQuery() stores the value under declinedNot, so this positive-only condition is skipped and the generic fallback returns the raw syntax token. As a result, filter chips and saved-search summaries show lowercase English yes/no (including in non-English locales) instead of the localized common.yes/common.no used for declined; handle DECLINED_NOT in the translated boolean branch as well.

Useful? React with 👍 / 👎.

@QichenZhu QichenZhu Oct 15, 2026 •

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.

This comment seems valid.

Screenshot 2026-10-15 at 11 19 59 PM

However, it's an existing issue. For example, the billable filter.

Screenshot 2026-10-15 at 11 22 49 PM

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 83d1cac. Negated Billable, Reimbursable and Rejected chips now show the translated Yes/No.

@QichenZhu

QichenZhu commented Oct 15, 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
    https://expensify.slack.com/archives/C049HHMV9SM/p1764642854883869
  • I verified any copy / text that was added to the app 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)
    Checking this off based on the author's checklist. I can't verify it since I don't have access to the internal issue.
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • 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 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.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • 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
android-native.webm
Android: mWeb Chrome
android-web.webm
iOS: HybridApp
ios-native.mov
iOS: mWeb Safari
ios-web.mov
MacOS: Chrome / Safari
mac-web.mov

@QichenZhu

Copy link
Copy Markdown
Contributor

NAB: The Rejected filter can't set negated or not. The Billable and Reimbursable filters have the same issue, but the Currency filter can.

nab.mov
currency

@c3024

c3024 commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

Thanks. I don’t think it makes much sense to have Is/Is Not for booleans, so the existing design looks fine to me. Similarly, -declined:yes doesn’t seem particularly useful when it can be expressed as declined:no. However, it already exists and is only accessible by typing it manually.

@QichenZhu

Copy link
Copy Markdown
Contributor

@MelvinBot please review this PR for accessibility issues.

@QichenZhu

QichenZhu commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

VoiceOver announces the "Rejected" menu as "declined, group" and it's not translated. The "Yes" and "No" options are not reachable.

voiceover.mov

@MelvinBot

Copy link
Copy Markdown
Contributor

Accessibility review

No blocking accessibility problems. The Rejected filter reuses existing components that already work with screen readers, and all 11 locales have the new label. Two inherited issues are more noticeable on this filter. Consider fixing them here or in a follow-up.

  1. The filters list row is announced as "declined", but the screen shows "Rejected". FilterList.tsx:79 sets accessibilityLabel={filterKey} (the raw query key), not the translated text on line 97. This breaks WCAG 2.5.3 (Label in Name): saying "click Rejected" in voice control won't activate the row. It affects every row, but this row has the biggest gap. Fix: use accessibilityLabel={translate(labelKey)} and add role={CONST.ROLE.BUTTON}.

  2. A negated value is hidden or unclear. If someone types -declined:yes:

    • The chip reads "-Rejected: Yes". The negation is just a hyphen (SearchUIUtils.ts:6142), which screen readers often skip or read as "dash".
    • The popup shows "Yes" selected with no hint of negation. Applying it keeps the hidden negation (ListPopup.tsx:25-30). That's because declined isn't in NEGATABLE_FILTER_KEYS, so no Is/Is not toggle appears.

    Billable and Reimbursable already behave this way. A simple fix for booleans is to turn -declined:yes into declined:no when the query is parsed. That would also cover the NAB above.

Checked and fine
  • ThumbsDown icon: a registered icon. It renders without a label, so Icon hides it from screen readers.
  • Yes/No list: each row has role="option" and a selected state, so screen readers announce "Yes, selected". The radio indicator isn't a separate tab stop.
  • Translations: search.filters.rejected is in all locale files. No hard-coded strings.
  • Focus order: no new focusable elements. The row follows the visible order (after Billable on Expenses, after Paid status on Reports).
  • getDisplayValue _NOT change: an improvement. Before, negated Billable and Reimbursable chips showed a raw, untranslated yes.
  • Autocomplete: suggestions read "declined:yes", like "billable:yes". Typing rej… won't find the filter. That's about discoverability, not accessibility.
  • Other inherited gaps outside this diff: the chip's close (×) button has no accessible name (DropdownButton.tsx:104-116), and the Yes/No list has no accessible name.

This review is based on reading the code. I didn't run a screen reader.

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

Deferring to the internal team on whether we should handle the accessibility issues here or separately.

@melvin-bot
melvin-bot Bot requested a review from JS00001 October 15, 2026 14:07
@melvin-bot melvin-bot Bot changed the title Add Rejected search filter for expenses and expense reports [Payment due @QichenZhu] Add Rejected search filter for expenses and expense reports Oct 15, 2026
@melvin-bot

melvin-bot Bot commented Oct 15, 2026

Copy link
Copy Markdown

🎯 @QichenZhu, 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/685831.

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.

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

Since we are adding a new filter, we need to follow our pattern of also creating a new column, and allowing that column to be sorted by

@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

@c3024

c3024 commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

@JS00001

Thanks. We implemented only the filter on the backend so far. The column needs backend work first, because the search response has no rejected value per expense or report, and sorting needs a new sortBy:declined with its own query timings. Can I ship the filter here and do the column and sort as a follow-up? I'll open the Auth PR for the response field and sort, then an App PR for the column.

@JS00001

JS00001 commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

yeah, @c3024 lets make sure we do a follow up to add the col to export, and sorting

@JS00001

JS00001 commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

@QichenZhu for #103309 (comment), the 'declined' is fine for now, do other filters allow you to reach yes/no?

@QichenZhu

Copy link
Copy Markdown
Contributor

do other filters allow you to reach yes/no?

The other filters have the same issue.

@QichenZhu

Copy link
Copy Markdown
Contributor

@c3024 please resolve conflicts.

@JS00001

JS00001 commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

@c3024 conflicts

…cted-search-filter

# Conflicts:
#	src/libs/SearchParser/autocompleteParser.js
#	src/libs/SearchParser/searchParser.js
@c3024

c3024 commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

conflicts fixed.

@JS00001
JS00001 merged commit 63b63cd into Expensify:main Oct 16, 2026
51 of 72 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

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

@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

🚀 Deployed to staging by https://github.com/JS00001 in version: 9.5.14-0 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor

A help site update is needed. I opened a draft docs PR: Docs updates for E/A#103309 Add declined search operator for rejected expenses and reports

This PR adds a new Rejected filter for all users (not beta-gated), so it counts as a new feature. The edit adds a declined: row to the expense and report tables in Use Search Operators to Filter and Analyze, next to the similar billable: and paid-status: rows.

@c3024, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR Ready for review

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/grgia in version: 9.5.14-3 🚀

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

Bundle Size Analysis (Sentry):

@melvin-bot

melvin-bot Bot commented Oct 20, 2026

Copy link
Copy Markdown

🤖 Payment issue created: #104496

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.

6 participants