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

AI-generated summary

Ethsim2 reports a bug where reverting a post revision updates the rendered Event onebox but fails to update the underlying [event] BBCode. In their steps, they edited an event’s date, reverted to a previous revision, and observed that the onebox displayed the earlier date while the post editor still showed the newer date in the BBCode. This discrepancy persisted after reloading.

Ethsim2 suspects this issue is related to recent changes in how recurring Event oneboxes are rendered, specifically mentioning PR #45321 by @awesomerobot, which introduced recurrence information. They question whether the revision restoration process has a gap or if the occurrence-calculation logic is causing the displayed date to change independently of the stored source.

In response, sam tags @martin, expressing a desire to avoid carrying excessive edge case code. martin confirms that the issue is related to PR #43187 and suggests it is best addressed after that PR is merged.

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.

@martin, I think you were looking at this one?

I certainly want to avoid carrying huge amounts of edge case code.

Yes it’s related to FEATURE: Add recurring event successor topic mode - Pull Request #43187 - discourse/discourse - GitHub , I think it makes more sense to address after that is merged.

1 Like