Redirect single-result admin user searches to the edit page #1010

Closed
opened 2026-11-05 10:31:25 -06:00 by Codex · 2 comments
Member

The /admin/users search should reduce unnecessary navigation when exactly one matching account exists.

The existing admin user flow is defined in the web routes and must retain its current authorization and mutation protections.

Scope

  • Update the /admin/users search handling in routes/web.php and its existing controller/view implementation to redirect exactly one match to that user’s edit page.
  • Keep zero-result and multiple-result searches on the existing results flow.
  • Preserve existing admin role checks, validation, pagination, and named rate limiting.

Acceptance Criteria

  • A search producing exactly one user redirects directly to that user’s existing edit page.
  • A search producing zero users continues to show the existing empty-results state.
  • A search producing multiple users continues to show the existing results list.
  • The redirect uses the existing user identifier and edit route, without exposing users outside the existing administrative authorization rules.

Test Coverage Required

  • Add feature coverage for zero, one, and multiple matching users through the /admin/users search endpoint.
  • Assert that the single-match response redirects to the existing edit-user route and identifies the matched account.
  • Assert that zero- and multiple-match responses retain the existing results behavior.

Progress Checklist

  • Locate the existing /admin/users search route, handler, results query, and edit route.
  • Implement the single-result redirect while preserving existing authorization and request protections.
  • Add focused feature tests for each result-count branch.
  • Run the repository’s prescribed focused feature test and formatting checks.
The `/admin/users` search should reduce unnecessary navigation when exactly one matching account exists. The existing admin user flow is defined in the web routes and must retain its current authorization and mutation protections. ## Scope - Update the `/admin/users` search handling in `routes/web.php` and its existing controller/view implementation to redirect exactly one match to that user’s edit page. - Keep zero-result and multiple-result searches on the existing results flow. - Preserve existing admin role checks, validation, pagination, and named rate limiting. ## Acceptance Criteria - A search producing exactly one user redirects directly to that user’s existing edit page. - A search producing zero users continues to show the existing empty-results state. - A search producing multiple users continues to show the existing results list. - The redirect uses the existing user identifier and edit route, without exposing users outside the existing administrative authorization rules. ## Test Coverage Required - Add feature coverage for zero, one, and multiple matching users through the `/admin/users` search endpoint. - Assert that the single-match response redirects to the existing edit-user route and identifies the matched account. - Assert that zero- and multiple-match responses retain the existing results behavior. ## Progress Checklist - [x] Locate the existing `/admin/users` search route, handler, results query, and edit route. - [x] Implement the single-result redirect while preserving existing authorization and request protections. - [x] Add focused feature tests for each result-count branch. - [x] Run the repository’s prescribed focused feature test and formatting checks.
Codex changed title from Go Directly to Edit User Page If Only One Match to Redirect single-result admin user searches to the edit page 2026-11-05 10:31:53 -06:00
Codex self-assigned this 2026-11-06 10:04:50 -06:00
Author
Member

Implemented and merged in PR #1018 (master merge commit 8bf3c4a2).

Nonblank admin user searches now redirect to the existing account edit route when the total match count is exactly one. Zero and multiple matches retain the results view, including pagination. Numeric searches still combine exact account IDs with username substring matches; an exact ID does not override additional matches. Blank searches remain unfiltered lists. Sole matches also redirect when the requested results page is out of range.

Archived/banned accounts remain searchable. Existing role middleware, edit-page policy checks, validation, and mutation rate limiters are preserved; editors still cannot edit higher-privilege accounts. No route, schema, dependency, or frontend asset changes were needed.

Verification: 41 focused feature tests passed with 249 assertions; Pint, PHPStan, and diff checks passed. All four progress checklist items are complete. Development and production deployment will follow this closeout.

Implemented and merged in PR #1018 (master merge commit 8bf3c4a2). Nonblank admin user searches now redirect to the existing account edit route when the total match count is exactly one. Zero and multiple matches retain the results view, including pagination. Numeric searches still combine exact account IDs with username substring matches; an exact ID does not override additional matches. Blank searches remain unfiltered lists. Sole matches also redirect when the requested results page is out of range. Archived/banned accounts remain searchable. Existing role middleware, edit-page policy checks, validation, and mutation rate limiters are preserved; editors still cannot edit higher-privilege accounts. No route, schema, dependency, or frontend asset changes were needed. Verification: 41 focused feature tests passed with 249 assertions; Pint, PHPStan, and diff checks passed. All four progress checklist items are complete. Development and production deployment will follow this closeout.
Author
Member

Deployment completed to development and production for merged PR #1018 (8bf3c4a2). Both release manifests now end in +pr1018-8bf3c4a2, and the deployed UserController checksum matches the merged source on both hosts.

The deployment changed only app/Http/Controllers/Admin/UserController.php, verified the previous file checksum before applying it, retained rollback copies of the controller and release manifest, restarted queues, and gracefully reloaded PHP-FPM. No migrations, dependency changes, or frontend rebuilds were required.

Rollback backups:

  • Development: /home/mvgldev/deploy-backups/pr1018-8bf3c4a2-8h90o7h0
  • Production: /home/mvgl/deploy-backups/pr1018-8bf3c4a2-xf87c4l4

HTTPS checks passed for home, login, and guest admin-search requests on both environments; admin search redirected to login as expected. Production rejected the default Python HTTP user agent with 403; the established deployment browser user agent passed all checks. Authenticated result-count behavior is covered by the 41 focused feature tests (249 assertions); no live accounts or domain data were modified during verification.

Deployment completed to development and production for merged PR #1018 (`8bf3c4a2`). Both release manifests now end in `+pr1018-8bf3c4a2`, and the deployed UserController checksum matches the merged source on both hosts. The deployment changed only `app/Http/Controllers/Admin/UserController.php`, verified the previous file checksum before applying it, retained rollback copies of the controller and release manifest, restarted queues, and gracefully reloaded PHP-FPM. No migrations, dependency changes, or frontend rebuilds were required. Rollback backups: - Development: `/home/mvgldev/deploy-backups/pr1018-8bf3c4a2-8h90o7h0` - Production: `/home/mvgl/deploy-backups/pr1018-8bf3c4a2-xf87c4l4` HTTPS checks passed for home, login, and guest admin-search requests on both environments; admin search redirected to login as expected. Production rejected the default Python HTTP user agent with 403; the established deployment browser user agent passed all checks. Authenticated result-count behavior is covered by the 41 focused feature tests (249 assertions); no live accounts or domain data were modified during verification.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MyVideoGameList/myvideogamelist.com#1010
No description provided.