Ethsim2
(Ethan )
3 Septiembre, 2026 12:02
11
Se ha logrado cierto progreso aquí.
Se ha fusionado un disparador de Fin de evento para Workflows:
main ← events-workflow-triggers
merged 10:09AM - 02 Sep 26 UTC
Previously, the events plugin had no way to drive a workflow from an RSVP or fro… m an event finishing, and a trigger node contributed by any plugin was added to the registry but never subscribed to its `DiscourseEvent` — so it saved fine, showed up in the palette, and silently never fired.
This change wires the subscription into node registration, which drops the hand-rolled `on(...)` workarounds in assign, topic voting and chat, and adds `trigger:event_participation_changed` and `trigger:event_ended`, both scopable to a single topic.
---
Split into two commits, since the first touches shared infrastructure:
- **`FIX: Subscribe trigger events for workflow nodes added by plugins`** — claiming a node now registers *and* subscribes it, and contributing plugins are flushed before the host claims its own, so ownership lands on them. Because the subscription goes through `Plugin::Instance#on`, a node stops listening while *its own* plugin is disabled rather than following the host's setting. This also drops a duplicate registration that let `trigger:chat_message_created` show in the palette while chat was disabled.
- **`FEATURE: Workflow triggers for event participation and event end`** — the two triggers. No `on(...)` wiring needed in the events plugin thanks to the commit above.
Three behaviour changes in the events plugin, each deliberate:
- Withdrawing an RSVP destroyed the record without publishing anything, so attendance state built from these triggers could never recover from someone leaving. Removal now publishes, and reads as `status: null` with `removed: true`. The livestream chat sync skips removals, so its follow/unfollow behaviour is unchanged.
- The ended occurrence travels with `:discourse_post_event_event_ended`. `set_next_date` moves the event on immediately afterwards, and `Event#starts_at` returns `nil` once a bounded series is past `recurrence_until`, so the event alone cannot say which occurrence ended.
- Re-submitting an unchanged RSVP still publishes, so the trigger ignores it rather than running a workflow twice for one decision.
Payload is `{event, post, topic, stats}`, plus `{user, participation}` on the participation trigger — modelled on `WebHook.build_calendar_event_payload` rather than `EventSerializer`, which goes admin-truthy under a system guardian. No JS, no core changes, no new site settings.
### Known gaps, documented rather than fixed
Bulk invite, `Event#create_invitees` (`insert_all!`), `reset_invitee_notifications` (`update_all`), `enforce_private_invitees!` (`delete_all`) and event/user destroy stay silent. `create_attendance!` swallows `RecordNotUnique`, so a concurrent first RSVP fires nothing. `event_ended` can re-fire if an edit resets `finished_at`, and is missed when an event is closed early: `EventDate.pending` merges `Event.open`, so the in-flight occurrence leaves the job's scope.
`EventListener` does not rescue `new`/`valid?`/`matches?` and `DiscourseEvent.trigger` re-raises, so a raising subscriber aborts `MonitorEventDates` mid-`find_each`. Adding `continue_on_error:` there breaks existing `track_events` assertions, so it is left for its own commit.
### Testing
Full `discourse-workflows` and `discourse-events` backend suites pass (4005 examples), plus the workflow specs in chat, assign and topic voting. Verified at runtime that all 22 trigger nodes have exactly one subscription and there are no duplicate registrations, and that both new nodes disappear from the palette and stop dispatching when `discourse_events_enabled` is off.
Meta: https://meta.discourse.org/t/discourse-calendar-events-webhook-triggers-automations-plugin/409623
Además, Workflows ya cuenta con una acción de Tema que puede Obtener un tema existente y Crear uno nuevo, y existe un nodo de Espera. Por lo tanto, gran parte de la propuesta de rotación podría ser componible como un flujo de trabajo, en lugar de requerir una función de archivado específica para eventos.
Algo como:
Fin de evento → Espera → Tema / Obtener → Tema / Crear
podría crear potencialmente un tema sucesor utilizando los datos de título/cuerpo/categoría del tema anterior, mientras se deja el tema completado intacto como archivo.
Lo que aún debe verificarse es exactamente qué partes del tema antiguo deben copiarse automáticamente: por ejemplo, etiquetas, cargas, estado de recurrencia del evento y si las respuestas deben moverse o simplemente dejarse atrás.
También tengo una PR abierta que introduce una acción de Evento en Workflows:
main ← Ethsim12:workflow-event-close
opened 06:39PM - 26 Aug 26 UTC
## What does this change?
Adds an `Event` action to Discourse Workflows, allo… wing a workflow to:
- Close an event
- Open an event
The action accepts a topic ID and optional actor. The event is resolved from the
topic's first post, consistent with the Events plugin's existing requirement that
an event belongs to the first post.
Rather than updating the event record directly, the action updates the `[event]`
block in the post raw using the normal workflow post-editing path. This allows the
existing Events post-edit synchronization to update the persisted event state.
Edits use the workflow execution context's `edit_post`, which applies the actor's
normal post-edit permissions and uses `skip_workflows: true` to avoid recursively
triggering workflows from the event state change.
The action is idempotent when the event is already in the requested state.
## Example
A `Post created` trigger can use:
- Action: `Event` → `Close event`
- Topic ID: `Input → topic.id`
- Performed by user: System user
This allows, for example, a reply to an event topic to automatically close the
event without closing the topic itself.
## Testing
- RuboCop: no offenses
- Syntax Tree: all files match expected format
- New Event workflow specs after final rebase: 8 examples, 0 failures
- Full `discourse-events` suite before final formatting/rebase: 1124 examples, 0 failures
- Manual browser test confirmed:
- `Post created` → `Event / Close event`
- dynamic `topic.id`
- System user actor
- replying to the topic immediately changed the event to `Closed`
- the topic itself remained open
- the change appeared live without a page refresh
- workflow execution completed successfully
## Screenshots
### Event workflow actions
<img width="1920" height="965" alt="workflow_screen_with_events_menu" src="https://github.com/user-attachments/assets/d283e9e6-e1db-4f5e-8cf9-3ed5c31f55fc" />
### Configuring the Event action with the triggering topic
<img width="1921" height="1003" alt="configuring_events_step" src="https://github.com/user-attachments/assets/725e28ca-f8f2-45f3-b124-4c3310c69eb9" />
### Event automatically closed after the workflow runs
<img width="1920" height="1000" alt="event_topic_after_auto_close" src="https://github.com/user-attachments/assets/a66138ad-bbaa-498a-9d87-2bd1eef9e495" />
La PR base agrega Cerrar evento y Abrir evento, y tengo un seguimiento apilado que agrega Establecer asistencia:
main ← Ethsim12:workflow-event-attendance
drafted 01:21PM - 29 Aug 26 UTC
Depends on #42932.
This is a stacked follow-up to #42932 adding `Set attendance… ` to the Event workflow action.
Until #42932 merges, GitHub's diff also contains the prerequisite Event action changes. Once #42932 is merged, this branch will be rebased onto the updated `main` so this PR contains only the attendance changes.
La acción está estructurada de manera que se puedan agregar operaciones específicas de eventos adicionales como seguimientos separados donde tenga sentido.
1 me gusta