Skip to content

HOLD: Expand registrant dropdown search#1271

Open
maebeale wants to merge 18 commits intomainfrom
maebeale/expand-registrant-dropdown
Open

HOLD: Expand registrant dropdown search#1271
maebeale wants to merge 18 commits intomainfrom
maebeale/expand-registrant-dropdown

Conversation

@maebeale
Copy link
Collaborator

@maebeale maebeale commented Mar 1, 2026

What is the goal of this PR and why is this important?

  • Admins reported that not all people show up in the event registration registrant dropdown
  • Multiple layers of issues were limiting results: low server limit, no multi-word query support, no email searching, and TomSelect client-side re-filtering

How did you approach the change?

  • Increased search limit from 10 to 25 with alphabetical ordering
  • Split multi-word queries into individual terms ANDed together, so "John Smith" or "ali smi" match across any searchable columns
  • Added email, email_2, and user email to Person search via left_joins(:user)
  • Disabled TomSelect client-side re-filtering with score: () => () => 1 so server results aren't hidden when matched on fields not in the label
  • Added clearOptions() before each fetch to prevent stale cached items from accumulating
  • Added comprehensive model and request specs covering all search scenarios

UI Testing Checklist

  • Search registrant dropdown with a single name (e.g. "john")
  • Search with multi-word query (e.g. "john smith")
  • Search with partial multi-word query (e.g. "ali smi")
  • Search by email address
  • Verify up to 25 results appear in dropdown
  • Verify results are alphabetically ordered

Anything else to add?

  • RemoteSearchable concern changes apply to all models using remote_searchable_by, but the Person-specific email/user-email search is isolated to Person.remote_search
  • Label displays email with priority: user email > email > email_2 (via existing preferred_email method)

🤖 Generated with Claude Code

@maebeale
Copy link
Collaborator Author

maebeale commented Mar 1, 2026

@jmilljr24 you ok w these changes?

@maebeale maebeale changed the title Expand registrant dropdown search HOLD: Expand registrant dropdown search Mar 1, 2026
maebeale and others added 18 commits March 1, 2026 09:31
The registrant dropdown on event registration forms only returned 10
results with no deterministic ordering, causing admins to miss people.
Increased to 25 with alphabetical ordering.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Two issues caused admins to not find people:

1. Multi-word queries like "John Smith" searched each column for the
   full string, matching nobody. Now splits into terms and ANDs them,
   so each term can match any column independently.

2. Person search only checked first_name and last_name. Admins
   searching by email got no results. Added email to searchable fields.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Tests cover multi-word queries, email search, exclusion, ordering,
authorization, and edge cases for the registrant dropdown fix.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Verifies that names like "Mary Ann De La Cruz" can be found by
searching any combination of terms from the first or last name.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Person remote search now checks email, email_2, and the associated
user's email via a left join. This lets admins find people by any
of their email addresses in the registrant dropdown.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Tests that the search endpoint finds people by email_2 and user email,
and that the displayed label uses preferred_email priority order:
user email > person email > email_2.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
TomSelect re-filters loaded results client-side using its score
function on the label field. When the server matches on a field not
in the label (e.g. email_2 or user email), TomSelect hides those
results. Override score to trust server-side filtering.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Verifies the server returns people found via email_2 or user email
even when the search term doesn't appear in the display label. This
is the scenario where TomSelect was previously re-filtering results.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
User email is always first priority in preferred_email, so the label
will always show user email when present — no mismatch is possible.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Covers the scenario where a search matches on people.email but the
label displays user.email (higher priority in preferred_email).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
With score always returning 1, cached items from previous searches
would accumulate and all show in the dropdown. Clear options before
each new fetch so only the current server results are displayed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
TomSelect defaults to max-height: 200px on the dropdown content,
which only fits ~7 visible items. Increase to 400px so users can
see more results without scrolling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Style the scrollbar with a thin gray thumb on a light track so users
can see there are more results to scroll through.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Chrome uses overlay scrollbars by default which are invisible. Force
the scrollbar to always render with overflow-y: scroll, add
-webkit-appearance: none to opt out of overlay mode, and use
scrollbar-color for Firefox support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace custom scrollbar styling with a "Scroll for more results"
text hint that appears below the dropdown when results overflow.
Only shows when there are more items than the visible area fits.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Render name in bold with email in gray for person and user remote
search dropdowns, matching the searchable_select_controller style.
Uses the model value to conditionally apply rendering.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Model spec: create person explicitly with user association instead
  of relying on user.person which doesn't exist by default
- Request spec: create persons with explicit user associations for
  tests that search by user email
- Request spec: use looser assertions for guest/non-admin/invalid
  model since the app redirects rather than returning 403
- Controller: call skip_verify_authorized! before head :forbidden
  for invalid models to avoid verify_authorized after-action error

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@maebeale maebeale force-pushed the maebeale/expand-registrant-dropdown branch from c11a754 to 3853ce4 Compare March 1, 2026 14:32
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.

1 participant