Skip to content

FreeScout: Filter the Users page by role and status - #1204

Closed
obenland wants to merge 7 commits into
WordPress:trunkfrom
obenland:add/freescout-users-filter
Closed

obenland wants to merge 7 commits into
WordPress:trunkfrom
obenland:add/freescout-users-filter

Conversation

@obenland

@obenland obenland commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Manage » Users lists every agent in one grid, active or not, so finding the admins, or the people who never logged in, means scanning it card by card.

This adds two filters next to the search, in WPOrgSite:

  • Role: All, Admins, Users.
  • Status: All, Active, Inactive. Inactive users are those who haven’t accepted their invite or logged in yet (the cards core grays out), and disabled users.

The heading's count follows what's shown, after core's search too. When nothing matches, the page says so.

The filters are kept in the URL (?role=admin&status=inactive) with history.replaceState, so going back from a profile keeps them, and a link can be shared. Agents who can manage users without being admins don't see admins at all (core leaves them out), so they get only the status filter.

Core's users view has no hook for this (just users.email, inside each card), so it's a script, Public/js/users.js. It reads what the cards already show: the admin badge, card-inactive, and the disabled icon. It hides cards with a class rather than inline, since core's search shows and hides them inline, so the two narrow the list together.

Testing

  1. As an admin, open Manage » Users with a few admins, users, an unaccepted invite, and a disabled user.
  2. Choose Admins, then Users; the cards and the heading's count follow. Choose Inactive: only the grayed-out and disabled cards are left.
  3. Search for a name: the heading counts what's left; clear it, the filters still apply.
  4. Pick a combination that matches nobody: "No users match." shows.
  5. Open a profile and go back: the filters are as you left them, and in the URL.
  6. As an agent with the Edit Users permission who isn't an admin, open Manage » Users: only the status filter shows.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added role and status filters to the Users page, with available options based on the listed users.
    • Filter selections are reflected in the page URL and work alongside search. User counts update to match the results, and a message appears when no users match.
  • Documentation
    • Updated the module documentation to describe the Users page filters and result counts.

obenland and others added 2 commits November 6, 2026 16:45
Manage » Users lists every agent in one grid, active or not. Add a role
filter (All, Admins, Users) and a status filter (Active, Inactive, All)
next to the search, each choice with how many users it matches. Inactive
users are invites not accepted yet and disabled users. The heading's
count follows what's shown, after core's search too, and the filters are
kept in the URL, so going back from a profile keeps them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings November 6, 2026 22:46

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

Core Committers: Use this line as a base for the props when committing in SVN:

Props obenland.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Explain Change →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 46 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1efdf678-481e-46fd-ba85-3655f7bca797
Commits

Reviewing files that changed from the base of the PR and between ae35210 and a46d7b6.

Files selected for processing: 2

  • freescout.wordpress.net/Modules/WPOrgSite/Public/css/site.css
  • freescout.wordpress.net/Modules/WPOrgSite/Public/js/users.js

No actionable comments were generated in the recent review.

Walkthrough

The WP.org Site module adds client-side role and status filters to the Users page. Filter selections persist in URL query parameters. Counts and results reflect the active filters and core search.

Changes: Users Page Filters

Layer / File(s) Summary
Filter behavior and presentation
freescout.wordpress.net/Modules/WPOrgSite/Public/js/users.js, freescout.wordpress.net/Modules/WPOrgSite/Public/css/site.css
The Users page filters cards by role and status. The heading count, empty-results message, and live announcement track visible users, including core search results. Styles format the controls and hide filtered cards.
Asset integration and module documentation
freescout.wordpress.net/Modules/WPOrgSite/Providers/WPOrgSiteServiceProvider.php, freescout.wordpress.net/Modules/WPOrgSite/tests/AssetsTest.php, freescout.wordpress.net/Modules/WPOrgSite/README.md, freescout.wordpress.net/Modules/WPOrgSite/module.json
The JavaScript bundle includes users.js, and the asset test expects it. The README describes the filters. The module version changes to 1.4.0.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant UsersPage as Users page
  participant UsersScript as users.js
  participant BrowserURL as Browser URL
  participant UserCards as User cards
  User->>UsersScript: Select role or status
  UsersScript->>BrowserURL: Replace query parameters
  UsersScript->>UserCards: Apply combined filters
  UsersScript->>UsersPage: Update counts and results message
  UsersPage->>UsersScript: Search key event
  UsersScript->>UsersPage: Recount visible users
Loading
Merge Risk: Minimal · previous review ae352

The filters are ready to merge with normal checks. A shared filter link may not take effect when only one user is listed.

Pre-merge checks: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the main change: role and status filters for the Users page.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 3 files. (2 skipped: 2 unsupported.)

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f87b334e-5a59-473c-8afb-24544ce3d078
Commits

Reviewing files that changed from the base of the PR and between 1dd24c2 and ae35210.

Files selected for processing: 3

  • freescout.wordpress.net/Modules/WPOrgSite/Public/css/site.css
  • freescout.wordpress.net/Modules/WPOrgSite/Public/js/users.js
  • freescout.wordpress.net/Modules/WPOrgSite/README.md
Files skipped from review as they are similar to previous changes: 2

  • freescout.wordpress.net/Modules/WPOrgSite/README.md
  • freescout.wordpress.net/Modules/WPOrgSite/Public/css/site.css

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

obenland and others added 5 commits November 6, 2026 16:48
Give the buttons the search field's border, in every state, and mute
the labels rather than the counts, so the numbers stand out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The heading already counts the users shown, so the filters' own counts
only added noise. Also say in the README that users who haven't logged
in yet count as inactive.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Teams module reuses #users-list, so the script also needs the
search the filters go next to. Drop a role from the URL for agents who
don't get the role filter, and document the constants.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The filters' light border in every state also covered focus, and
Bootstrap shows a button's focus only through its border, so tabbing
through them showed no focus at all. Keyboard focus gets Bootstrap's
focus border back; clicking still looks as before. Also restore the
README's curly apostrophe in "haven’t", which the previous commit
straightened.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wporg-sync wporg-sync closed this in be1ac15 Nov 6, 2026
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.

2 participants