Add event: filter to the topic filter query language (Discourse Events plugin extension)

סיכום מבוסס בינה מלאכותית

nathank proposed extending the Discourse topic filter query language to include an event: filter for the Discourse Events plugin. The goal is to allow server-side filtering of topics with or without associated events, overcoming limitations of existing client-side workarounds and dedicated category conventions. This feature would enable efficient, permission-aware, and paginated topic lists similar to those provided by the Solved and Assign plugins.

nathank suggested syntax like event:yes, event:no, and combinations with other filters (e.g., tag:meetup event:yes). A key use case is creating shareable, embeddable URLs that reliably list all events across a site, sorted by date, which is currently difficult to achieve with confidence.

awesomerobot expanded on the proposal with a more robust syntax specification, including:

  • State filters: event:any, event:upcoming, event:ongoing, event:past.
  • Date filters: event-after:YYYY-MM-DD, event-before:YYYY-MM-DD.
  • Attendee filters: event-attending:<username>, event-attending:me.
  • Sorting: order:event-start, order:event-start-asc.

The implementation was merged via PR #45158. nathank later requested an additional sort option, order:event-smart, to replicate the default “Events” category behavior, which displays upcoming events soonest-first followed by past events most-recent-first.

:information_source: This would allow filtering for topics that have an Event attached via the Events plugin, using the /filter route and the Custom Topic Lists plugin.

The problem

The Discourse Events plugin creates rich event topics, but there’s currently no way to isolate them from non-event topics using the topic filter query language.

The existing workarounds all have downsides:

  • The /upcoming-events route shows events as a calendar, not a filterable topic list - although it perhaps should!!!
  • The Events Calendar on Custom Lists theme component has a client-side “Only show topics with events” setting, but it operates after the list loads — it’s not a true server-side filter, doesn’t play well with pagination, and can behave inconsistently
  • Convention-based approaches (dedicated categories, required tags) require strict content management discipline

Proposed solution

The Events plugin should extend the topic filter DSL with an event: filter, following the same pattern already used by the Solved plugin (status:solved / status:unsolved) and the Assign plugin (?assigned=username).

Example syntax:

event:yes                          # Topics with an event attached
event:no                           # Topics without an event (via -event:yes)
-category:announcements event:yes  # Events outside of announcements
tag:meetup event:yes order:created # Tagged meetup topics that have events, sorted by newest

A status:events variant could also be considered for consistency with the existing status: namespace, but event: reads more naturally for the primary use case.

Why this is the right layer

The filter documentation explicitly states:

The Events plugin already stores structured event data (start date, end date, status, RSVPs) in dedicated tables. A server-side filter can query this efficiently — something a client-side component simply can’t do.

Use case example

As a community manager, I want a shareable URL — linkable in my sidebar, embeddable via Custom Topic Lists, and usable in the Filtered Topic Lists theme component — that reliably shows all topics across any category that have an event attached, sorted by event date.

Today, I can’t construct that query with confidence. With an event: filter, I could:

event:yes order:created

…and get a clean, paginated, permission-aware topic list of all events on my site.


Related Topics

3 לייקים

good idea! how about:

  • event:any topics with an event
  • -event:any topics without an event
  • event:upcoming events that haven’t started yet
  • event:ongoing events happening now
  • event:past events that have ended, including closed events
  • event:upcoming,ongoing a comma means “any of”
  • -event:<state> excludes topics whose event is in that state (e.g. -event:past)
  • event-after:YYYY-MM-DD events starting on or after a date
  • event-before:YYYY-MM-DD events starting before a date
  • event-attending:<username> events that user is going to
  • event-attending:me events you’re going to
  • order:event-start sort by event start, latest first
  • order:event-start-asc sort by event start, soonest first
5 לייקים

This is brilliant - and I’m enjoying using it!

Do you think it would be possible to add one more event-specific filter to replicate the functionality in existing Events categories?

What I’m missing is the behavior of sort categories by event start date enabled — upcoming events (soonest first), then past events (most recent first).

Proposal:

order:event-smart  # upcoming soonest → furthest, then past most-recent → oldest

This would let me replicate the Events category experience via the filter, so I can put the same “smart chronological” view on any list, not just dedicated categories.

לייק 1