Skip to content

Keep People "Email addresses" in sync with the active filter - #2533

Merged
maebeale merged 1 commit into
mainfrom
maebeale/email-list-from-people-filter
Sep 11, 2026
Merged

maebeale merged 1 commit into
mainfrom
maebeale/email-list-from-people-filter

Conversation

@maebeale

Copy link
Copy Markdown
Collaborator

🤖 suggested review level: 3 Read 📖 small view/controller change, re-renders one link in the existing Turbo frame

Admins who filter the People directory and then click "Email addresses" now get emails for just the filtered people, not everyone.

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

  • The "Email addresses" link sat in the static page header and was built once from the page's query params.
  • Filters applied afterward drive the people_results Turbo frame without changing the top-level URL, so the link kept its stale (usually empty) params and returned every person's email.

How did you approach the change?

  • Moved the link into a partial re-rendered inside the frame response via turbo_stream.replace (same pattern as the people count), so it always carries the current filter.
  • Gated it on :manage? instead of :index? to match the other admin-only buttons.
  • Added a request spec covering the frame link and a Features & tips entry.

Anything else to add?

:index? and :manage? both resolve to super-admin today, so who can use the feature is unchanged — the gate switch is for intent/future-proofing.

The link lived in the static index header and was built once from the
page's query params, so filters applied later via the Turbo frame never
reached it — clicking it returned every person's email. Re-render the
link inside the frame response (mirroring the people_count pattern) so
it always carries the current filter, and gate it on :manage? rather
than :index?.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@maebeale
maebeale marked this pull request as ready for review September 11, 2026 03:25
@maebeale
maebeale merged commit 30fbeed into main Sep 11, 2026
3 checks passed
@maebeale
maebeale deleted the maebeale/email-list-from-people-filter branch September 11, 2026 03:49
@maebeale
maebeale requested a review from jmilljr24 September 11, 2026 03:51
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