[PR #7827] [MERGED] fix(admin): apply listUsers filter when filterValue is defined #15823

Closed
opened 2026-04-13 10:14:44 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7827
Author: @coderrshyam
Created: 2/6/2026
Status: Merged
Merged: 2/12/2026
Merged by: @himself65

Base: canaryHead: patch-1


📝 Commits (7)

  • 66c63eb fix(admin): handle falsy filter values in listUsers query
  • 9b01bed Add related test
  • 8d8ba5f Merge branch 'canary' into patch-1
  • d269a95 fix test
  • f9f17fe Merge branch 'canary' into patch-1
  • 6b4b740 test: correct regression test case
  • 90b4e0e test: clearer case naming

📊 Changes

2 files changed (+47 additions, -1 deletions)

View changed files

📝 packages/better-auth/src/plugins/admin/admin.test.ts (+46 -0)
📝 packages/better-auth/src/plugins/admin/routes.ts (+1 -1)

📄 Description

Previously, listUsers only applied filters when filterValue was truthy. This caused valid filters such as false, 0, or empty strings to be ignored (e.g. filtering banned = false or emailVerified = false).

Updated the condition to explicitly check for undefined, ensuring all valid filter values are handled correctly.

Closes: #7837

I can see one pr is opened to release 1.4.19, please make sure tha this fix should also be landed on the upcoming minor version


Summary by cubic

Fix listUsers so filters apply when filterValue is defined, allowing falsy values like false, 0, and ''. Examples: banned=false and emailVerified=false.

  • Bug Fixes
    • Use filterValue !== undefined; add a focused regression test (with temp user ban/unban) and clearer test name.

Written for commit 90b4e0e046. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/7827 **Author:** [@coderrshyam](https://github.com/coderrshyam) **Created:** 2/6/2026 **Status:** ✅ Merged **Merged:** 2/12/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `patch-1` --- ### 📝 Commits (7) - [`66c63eb`](https://github.com/better-auth/better-auth/commit/66c63eba53b76cbb8c98c0fc15b537ae73b39ab6) fix(admin): handle falsy filter values in listUsers query - [`9b01bed`](https://github.com/better-auth/better-auth/commit/9b01bedf4352dd5c8a0d3bded1fd37b9e9be95cd) Add related test - [`8d8ba5f`](https://github.com/better-auth/better-auth/commit/8d8ba5fe0c81f58f9f7834a36c789bdc8fa98902) Merge branch 'canary' into patch-1 - [`d269a95`](https://github.com/better-auth/better-auth/commit/d269a9506530e027165a468dbfc7a039593eccd7) fix test - [`f9f17fe`](https://github.com/better-auth/better-auth/commit/f9f17fe47f16e931ded0bee75a7e1e55cf5bfc3a) Merge branch 'canary' into patch-1 - [`6b4b740`](https://github.com/better-auth/better-auth/commit/6b4b74018817bd1cf1aa6ac07c798e590626dcce) test: correct regression test case - [`90b4e0e`](https://github.com/better-auth/better-auth/commit/90b4e0e046fc924e120d66e84f185c1a069bf9fe) test: clearer case naming ### 📊 Changes **2 files changed** (+47 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/admin/admin.test.ts` (+46 -0) 📝 `packages/better-auth/src/plugins/admin/routes.ts` (+1 -1) </details> ### 📄 Description Previously, listUsers only applied filters when `filterValue` was truthy. This caused valid filters such as `false`, `0`, or empty strings to be ignored (e.g. filtering `banned = false` or `emailVerified = false`). Updated the condition to explicitly check for `undefined`, ensuring all valid filter values are handled correctly. Closes: #7837 > I can see one pr is opened to release `1.4.19`, please make sure tha this fix should also be landed on the upcoming minor version <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fix listUsers so filters apply when filterValue is defined, allowing falsy values like false, 0, and ''. Examples: banned=false and emailVerified=false. - **Bug Fixes** - Use filterValue !== undefined; add a focused regression test (with temp user ban/unban) and clearer test name. <sup>Written for commit 90b4e0e046fc924e120d66e84f185c1a069bf9fe. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 10:14:44 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#15823