Skip to content

Fix event filtering on tags#174

Merged
edalzell merged 3 commits into
mainfrom
173-upcoming-events-tag-not-accepting-event-id-after-upgrade-to-6
Jul 16, 2026
Merged

Fix event filtering on tags#174
edalzell merged 3 commits into
mainfrom
173-upcoming-events-tag-not-accepting-event-id-after-upgrade-to-6

Conversation

@edalzell

@edalzell edalzell commented Jul 16, 2026

Copy link
Copy Markdown
Member

Problem

The event parameter on the events tags (between, upcoming, today, in, calendar) is ignored. Passing event="some-id" returns all occurrences in the collection instead of only the occurrences for that single entry.

Fixes #173.

Reason

In the v6 refactor (#168), Events::entries() was rewritten to delegate to a new Entries query class that only filters by collection:

$query = Entry::query()->whereIn('collection', $this->collections->map->handle()->all());

The previous implementation branched on the event id to filter where('id', $id). That branch was dropped — the generator still stores the id in $this->event, but the field became dead code and is never read by the query. So every tag routed through Entries returns the whole collection regardless of event.

Solution

  • Restore the id filter in src/Entries.php using a two-branch when() so event and collection are mutually exclusive, with event taking precedence — matching the v5 behavior.
  • Guard against ambiguous usage: the Events generator constructor now throws if both collection and event are passed. The check runs on the raw params before collection gets its 'events' default applied, so it reflects true user intent. This does not affect events:download_link, which legitimately accepts both.
  • Tests: reproduce the regression (a specific event now returns 4 occurrences, not 5 when an unrelated entry exists in the collection) and cover the new exception.
  • Docs: note that collection and event are mutually exclusive across the query tags.

@edalzell edalzell linked an issue Jul 16, 2026 that may be closed by this pull request
@edalzell edalzell added the fix label Jul 16, 2026
@edalzell
edalzell merged commit dbf43e6 into main Jul 16, 2026
25 checks passed
@edalzell
edalzell deleted the 173-upcoming-events-tag-not-accepting-event-id-after-upgrade-to-6 branch July 16, 2026 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upcoming events tag not accepting event ID after upgrade to 6

1 participant