Reverting a post revision updates the Event onebox but leaves the underlying BBCode unchanged

AI-generated summary

Ethsim2 reported a bug where reverting a post revision containing Event BBCode updates the rendered onebox to show the earlier date, but fails to restore the underlying [event] BBCode attributes in the editor. The user detailed steps to reproduce the issue: creating an event, editing its date, and reverting to the previous revision results in a visual update to the onebox, while the source code retains the newer date. This discrepancy persists after reloading the topic.

The reporter suspects the behavior is linked to recent upstream changes in Discourse, specifically PR #45321 by @awesomerobot, which introduced recurrence information and updated how Event oneboxes calculate and display current occurrences. The new logic may prioritize dynamic occurrence calculation over the stored BBCode date, causing the onebox to reflect the reverted state (or a calculated state) independently of the source. Ethsim2 noted that they manually corrected the BBCode to resolve the inconsistency.

Key questions raised include whether this divergence between the displayed onebox and stored source is expected behavior due to the new recurrence handling, or if it represents a regression in the revision restoration process. The reporter provided specific environment details (Discourse version 2026.11.0-latest.2) and referenced commit links for context, seeking clarification on whether the revision reversion mechanism needs adjustment to ensure BBCode attributes are correctly restored alongside the visual display.

Problem

I’ve encountered an apparent inconsistency when reverting a post revision containing Event BBCode.

After reverting to an earlier revision, the rendered Event onebox displays the earlier Event date, but opening the post editor shows that the underlying [event] BBCode still contains the date from the newer revision.

The discrepancy persisted after reloading the topic.

I’m wondering whether this is related to recent changes in how recurring Event oneboxes are rendered.

Steps leading to the issue

  1. Start with a post containing Event BBCode, including start and end dates.

  2. Edit the Event to change its date or time, and save.

  3. Open the post’s revision history.

  4. Revert to the earlier revision.

  5. Observe that the displayed Event onebox changes to the earlier date.

  6. Open the post editor and inspect the [event start="..." end="..."] attributes.

  7. Observe that the BBCode still contains the newer date, despite the apparent reversion.

Expected behaviour

If reverting a revision is intended to restore the original Event dates, I would expect both the displayed Event and the underlying BBCode to reflect the reverted values.

Alternatively, if the Event onebox intentionally displays a dynamically calculated occurrence that differs from the stored BBCode, it would be helpful to clarify how this should interact with revision history.

Actual behaviour

The Event onebox reflected the earlier date, while the post editor continued to show the newer date in its BBCode.

I manually corrected the BBCode to restore consistency.

Relevant upstream changes

I noticed that @awesomerobot’s recent PR introduced recurrence information and updated occurrence handling for Event oneboxes:

My understanding is that this change allows recurring Event oneboxes to display the current occurrence using recurrence information, rather than necessarily displaying the original date stored in the onebox markup.

I also encountered an upstream merge conflict involving Event recurrence handling while updating my separate, still-open PR:

I resolved that conflict by preserving the upstream recurrence handling while retaining the recurrence-anchor behaviour required by the successor-topic implementation.

I’m mentioning this for development context, rather than suggesting that PR #43187 is responsible for the behaviour observed on my site.

Environment

Questions

Could the interaction between post revision reversion, stored Event BBCode and the newer Event onebox recurrence handling be checked?

In particular:

  • Is it expected that reverting a revision can change the Event onebox without restoring the corresponding BBCode attributes?

  • Could the newer occurrence-calculation logic explain the displayed date changing independently of the post’s stored source?

  • If the underlying BBCode should have been reverted, is this a gap in the revision restoration process?

I would appreciate clarification on whether this is expected behaviour or a regression.