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

**URL:** <https://meta.discourse.org/t/reverting-a-post-revision-updates-the-event-onebox-but-leaves-the-underlying-bbcode-unchanged/417920>\
**Category:** Bug\
**Tags:** events\
**Created:** [20 november 2026 om 09:52 UTC](https://meta.discourse.org/t/reverting-a-post-revision-updates-the-event-onebox-but-leaves-the-underlying-bbcode-unchanged/417920 "2026-11-20T09:52:48Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Ethsim2](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ethsim2/32/522255_2.png) [@Ethsim2](https://meta.discourse.org/u/Ethsim2)\
**Post date:** [20 november 2026 om 09:52 UTC](https://meta.discourse.org/t/reverting-a-post-revision-updates-the-event-onebox-but-leaves-the-underlying-bbcode-unchanged/417920/1 "2026-11-20T09:52:48Z")

</div>

## 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:

> <https://github.com/discourse/discourse/pull/45321>
>
> This adds recurrence information to event oneboxes, including the end date (when… set)
> 
> \<img width="700" alt="image" src="https://github.com/user-attachments/assets/56f9416d-4695-4ae3-a51d-c228c15c187b" /\>
> 
> To accomplish this it:
> 
> \- Adds a schema.org \`eventSchedule\` to the event JSON-LD (frequency, day, week of the month, end date, timezone), and has the onebox read it.
> \- Stores the schedule in the onebox as a recurrence rule, and works out the current occurrence on the server with the existing \`rrule\` setup. Posts get it through a new \`event\_onebox\_occurrences\` serializer field, and emails get it through \`reduce\_cooked\`, so neither shows a past date. 
> \- Updates the date badge's \`\<time datetime\>\` together with the visible date.

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:

> <https://github.com/discourse/discourse/pull/43187>
>
> \## Summary
> 
> Adds an opt-in mode for recurring Events where each completed occu…rrence is preserved in its own Topic and the next occurrence is created in a successor Topic.
> 
> The new \`discourse\_post\_event\_recurring\_topic\_mode\` enum site setting has two values:
> 
> \- \`reuse\_topic\` — existing behavior and the default
> \- \`create\_next\_topic\` — archive the completed occurrence Topic and create a successor Topic for the next occurrence
> 
> The existing reuse-topic behavior is retained. Successor-topic creation applies only when the new mode is explicitly enabled.
> 
> \## Details
> 
> When \`create\_next\_topic\` is enabled, the scheduled event-date monitor:
> 
> \- preserves the completed Topic by converting its recurring Event into a one-off occurrence, retaining the completed dates and attendance
> \- renames the archived Topic using a distinctive date-bearing title, such as \`Meeting (archived event on 2026-09-03)\`, respecting title-length and duplicate-title validation
> \- creates a successor Topic from the original post content, advancing the Event start/end dates while preserving unrelated content and Event attributes
> \- preserves the category, tags, original author and recurring Event metadata
> \- carries forward recurring \`going\` invitees while leaving one-off attendance associated with the completed occurrence
> \- performs archival and successor creation transactionally, so a failed rollover leaves the occurrence pending for retry without partially archiving the Event
> \- emits the \`discourse\_post\_event\_event\_ended\` workflow trigger with the completed occurrence's recurring-series metadata
> 
> If the recurrence has no next occurrence, the completed Topic is retained as a one-off Event and no successor Topic is created.
> 
> \### Archived Topic titles
> 
> The archived title initially uses the format:
> 
> \`{original title} (archived event on {YYYY-MM-DD})\`
> 
> The title is truncated where necessary to respect \`SiteSetting.max\_topic\_title\_length\`, while preserving as much of the distinguishing suffix as possible.
> 
> Rather than querying for duplicate titles before every archival revision, the implementation relies on Discourse's existing Topic validation. If \`PostRevisor#revise!\` fails solely because the archived title is already in use, it retries with an additional Topic ID or numbered suffix.
> 
> The generic suffix-generation logic is implemented in \`Topic#title\_with\_disambiguating\_suffix\`. Retries are bounded to five attempts, and unrelated revision failures are not retried.
> 
> The retry is attached to \`PostRevisor\`, because archival renames the \*\*existing Topic\*\*. \`PostCreator.create!\` subsequently creates the successor using the original title.
> 
> Duplicate-title validation retains Discourse's normal category and visibility rules, including the treatment of Topics hidden from the original author.
> 
> \### Recurrence and editing
> 
> The implementation preserves the original recurrence anchor separately from the displayed occurrence start date. This allows successor Topics to retain recurrence patterns such as the last weekday of a month without drifting to a different ordinal weekday.
> 
> The Event serializer and frontend recurrence handling use this anchor when reconstructing the recurring schedule. Explicit changes to the recurrence pattern or relevant dates can update the anchor.
> 
> The successor service also:
> 
> \- distinguishes rendered Event markup from examples inside fenced code blocks
> \- recognises unquoted BBCode attribute values containing characters such as apostrophes
> \- rewrites actual Event attributes positionally, without altering attribute-like words inside quoted names or locations
> \- handles differently capitalised aliases of Event attributes
> \- preserves seconds and fractional seconds in timed Event attributes where present, avoiding unintended changes to Event dates during archival
> \- preserves completed Event dates and RSVP information when archiving an occurrence, including Events without an explicit end time
> \- handles Events removed from a successor Topic and subsequently recreated without inheriting stale recurrence-anchor data
> 
> Generic BBCode parsing and attribute rewriting have been extracted from the successor service into reusable core functionality.
> 
> The implementation uses the \`BbcodeRewriter\` scan/mark/rewrite path. The separate, unused token-based \`PrettyText.update\_bbcode\_attributes\` API was removed from this PR in \[6d13371\](https://github.com/discourse/discourse/pull/43187/commits/6d13371aae5), avoiding two parallel rewriting mechanisms.
> 
> \### Access control and moderation
> 
> Successor-topic creation is restricted to eligible standard Topics. Recurring Events in private messages continue using their existing Topic, preserving the original private-message access restrictions rather than creating potentially public successors.
> 
> Automated successor creation uses the system user as the acting user for creation and the required Event validation. The original author remains the author of the successor Topic and the editor of the archived post, preserving normal editing attribution and rendering permissions.
> 
> This allows an established recurring series to continue after ordinary Event-creation group or category permission changes.
> 
> However, successor creation is deferred when:
> 
> \- the original author is suspended, silenced, inactive, staged or otherwise prevented from posting
> \- the original post is hidden or deleted
> \- the source Topic is non-visible or deleted
> \- a recorded raw-content edit by another human user makes republication under the original author's identity unsafe
> 
> The last restriction prevents an editor of another user's wiki post from introducing a recurring Event that later publishes new non-wiki Topics under the original author's identity.
> 
> Trusted system-user revisions and metadata-only edits by another human user, such as moderator title changes, do not automatically prevent rollover.
> 
> These checks apply both to the scheduled monitor and to direct calls to the successor-creation service.
> 
> When rollover is deferred, the occurrence remains pending rather than being archived or publicly republished. The monitor emits a diagnostic warning at most once every 24 hours per affected Event occurrence, avoiding repeated warnings on every scheduled run.
> 
> This approach is deliberately conservative: a legitimate raw-content edit by another human user can also defer rollover because the implementation does not separately persist the principal who originally authorised the Event content.
> 
> \### Event hosts
> 
> A recurring Event may retain hosts who subsequently become ineligible to host a newly created Event.
> 
> During rollover:
> 
> \- the archived occurrence retains its existing eligible or ineligible host associations for historical accuracy
> \- archived hostnames are reconstructed from persisted host associations, avoiding failures caused by renamed or stale usernames
> \- the successor inherits only hosts who currently satisfy the relevant account and category eligibility requirements
> \- rollover can continue when no eligible hosts remain
> 
> This prevents an inherited suspended, inactive or otherwise ineligible host from repeatedly blocking successor creation.
> 
> \### Service architecture and failure isolation
> 
> Successor creation uses Discourse's \`Service::Base\` framework, including parameter validation, model resolution, a \`rollover\_allowed\` policy and transactional service steps.
> 
> The scheduled monitor handles exceptions separately for each Event date, logging the affected occurrence without preventing the remaining pending Events from being processed.
> 
> Failed successor creation rolls back the archival transaction. A subsequent monitor run can retry the occurrence without leaving a partially archived Event or duplicate successor.
> 
> \## UI smoke test
> 
> The original UI and scheduled-job smoke tests were performed with \`discourse\_post\_event\_recurring\_topic\_mode\` set to \`create\_next\_topic\`.
> 
> \*\*Site setting\*\*
> 
> \<img width="678" height="142" alt="01-admin-setting-create-next-topic" src="https://github.com/user-attachments/assets/78dc6698-6886-4c10-81d4-22d991f0f452" /\>
> 
> \*\*Before rollover — recurring occurrence on September 3\*\*
> 
> \<img width="1512" height="958" alt="02-before-rollover-sep-3-every-thursday" src="https://github.com/user-attachments/assets/3150b843-1264-4990-8dd8-2e931e28b9dc" /\>
> 
> \*\*Completed occurrence preserved in the archived Topic\*\*
> 
> \<img width="2048" height="1076" alt="03-archived-topic-2026-09-03" src="https://github.com/user-attachments/assets/d6d28341-f684-4ba8-9b54-2fec0c537bb7" /\>
> 
> \*\*Successor Topic created for the next weekly occurrence\*\*
> 
> \<img width="2048" height="1073" alt="04-successor-topic-sep-10-every-thursday" src="https://github.com/user-attachments/assets/0ff611b4-f316-4130-bb75-7948d36e61e9" /\>
> 
> These initial smoke tests confirmed that the completed Topic was preserved with a dated title and that a successor Topic was created for the following weekly occurrence, including through the normal supervised Sidekiq scheduler.
> 
> \*\*Note:\*\* These screenshots were captured before the subsequent review-driven changes, including the revised archived-title format. They demonstrate the original end-to-end functionality rather than the exact appearance of the latest implementation.
> 
> \## Tests
> 
> \### Latest combined local regression run — 27 October 2026
> 
> \> \*\*453 examples, 0 failures\*\*
> 
> Executed against commit \`909b0c7\`, including the BBCode API cleanup and archived-title refactor.
> 
> The run covered:
> 
> \- \`spec/models/topic\_spec.rb\`
> \- \`plugins/discourse-events/spec/services/discourse\_events/events/event/create\_successor\_topic\_spec.rb\`
> \- \`plugins/discourse-events/spec/jobs/scheduled/monitor\_event\_dates\_spec.rb\`
> \- \`plugins/discourse-events/spec/lib/bbcode\_rewriter\_spec.rb\`
> \- \`spec/lib/pretty\_text\_bbcode\_rewriter\_spec.rb\`
> 
> Coverage includes:
> 
> \- Topic model validation and duplicate-title behaviour
> \- normal recurring Event rollover and final occurrence handling
> \- archived-title formatting, truncation and collision recovery
> \- bounded title retries and rejection of unrelated validation failures
> \- duplicate-title visibility rules for Topics hidden from the original author
> \- BBCode parsing, rewriting and preservation of unrelated attributes
> \- Event attribute aliases and preservation of timestamp precision
> \- successor-service eligibility policies and transactional rollback
> \- existing scheduled-monitor regression scenarios
> 
> An additional focused regression test for archived-title collisions involving a Topic hidden from the author also passed independently.
> 
> \### Earlier Event and workflow regression run
> 
> \> \*\*168 examples, 0 failures\*\*
> 
> The earlier run covered:
> 
> \- \`spec/jobs/scheduled/monitor\_event\_dates\_spec.rb\`
> \- \`spec/models/discourse\_events/events/event\_spec.rb\`
> \- \`spec/integration/workflows\_event\_triggers\_spec.rb\`
> 
> Coverage included:
> 
> \- existing reuse-topic behavior, normal successor rollover and final recurrence
> \- all-day Events, timezones and monthly recurrence anchors
> \- private-message confidentiality and account-level moderation safeguards
> \- restricted original authors and changes to category/Event-creation permissions
> \- cross-user wiki edits, system-user revisions and moderator metadata-only edits
> \- transactional rollback, failure isolation and retry behaviour
> \- recurring RSVP inheritance and preservation of completed attendance
> \- workflow event-ended payloads
> \- rate-limited warnings when rollover is deferred
> 
> This was a separate, earlier test run, not part of the latest 453-example invocation.
> 
> \### Formatting and linting
> 
> The latest modified Ruby files passed SyntaxTree and RuboCop:
> 
> \> \*\*4 files inspected, no offences detected\*\*
> 
> The pre-commit hooks also passed for both review-driven refactor commits. The resulting working tree was clean.
> 
> The original UI smoke tests predate the later review-driven changes; the local regression runs above provide coverage of the subsequent implementation.

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

- Discourse version: `2026.11.0-latest.2`

- Additional commits: `+1 commit`

- Reported core commit: [https://github.com/discourse/discourse/commit/e036899dffc62ba5080435935e5174765518b672](https://github.com/discourse/discourse/commit/e036899dffc62ba5080435935e5174765518b672)

## 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.

---

_[View the full topic](https://meta.discourse.org/t/reverting-a-post-revision-updates-the-event-onebox-but-leaves-the-underlying-bbcode-unchanged/417920)._
