Skip to content

fix: render the correct host sponsor on events listing cards - #2981

Merged
mroderick merged 4 commits into
masterfrom
fix/events-listing-wrong-host
Oct 1, 2026
Merged

mroderick merged 4 commits into
masterfrom
fix/events-listing-wrong-host

Conversation

@mroderick

Copy link
Copy Markdown
Collaborator

Fixes #2975.

Summary

Workshop cards on the events listing could show the wrong sponsor as the venue, or none at all. EventsController#load_events eager-loaded workshop_host: :sponsor together with :sponsors; both route through the workshop_sponsors table in one join, and the host scope then binds to the wrong table alias, so workshop_host came back nil or pointing at a non-host sponsor on a plan-dependent subset of cards.

The host is now preloaded instead of joined, the same pattern Listable.most_recent and the chapter controller already use. Sponsor and organiser lists on cards also render in name order now (previously join-row order), and the card fragment cache version bumps to v3 so cards cached with the wrong venue are not served after deploy.

Review notes

  • The fix approach is the main thing to weigh: preload versus deriving the host from eager-loaded workshop_sponsors records (the issue's other candidate, which would also cut join fan-out). Preload is the smaller change and matches the existing pattern; the derivation approach would need Workshop#host or the presenter to read from loaded through records.
  • app/queries/dashboard_query.rb eager-loads :workshop_host alongside :sponsors in one join — the same alias trap, left out of this PR as follow-up work.

Testing

New specs cover: the host resolves to the host sponsor for every workshop on a page, the full sponsor list is present, name ordering for sponsors and organisers, and sorting with a blank member name (member names are only required for active members).

Post-deploy validation

The venue on a card is the visible change: spot-check /events/past and /events/upcoming after deploy — each workshop card should name its host sponsor. The v3 cache key re-warms the card cache on first render. Watch Rollbar for ArgumentError from presenter sorting as the failure signal; nil-name records were the trigger class the nil-safe sort covers.

Eager-loading workshop_host together with :sponsors routes both through
the workshop_sponsors table in one join; the host scope then binds to the
wrong table alias, so workshop_host comes back nil or points at a
non-host sponsor and event cards show the wrong venue. Preload the host
instead, mirroring Listable.most_recent.

Sponsors and organiser avatars on event cards now render in name order;
previously the order followed join-row order.
Sorting sponsors and organisers by name compared nil against String when
a member or sponsor has no name (member names are only required for
active members), which would raise while rendering a card. Sort with a
nil-safe key instead.

Bump the event card fragment cache version to v3: previously cached
cards rendered the wrong venue and must not be served after this fix
deploys.
@mroderick
mroderick marked this pull request as ready for review October 1, 2026 12:39
@mroderick
mroderick merged commit cdbba5f into master Oct 1, 2026
11 checks passed
@mroderick
mroderick deleted the fix/events-listing-wrong-host branch October 1, 2026 13:36
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.

Events listing can render the wrong sponsor as venue (eager_load host loss)

1 participant