Skip to content

Prevent associating a standard edition with itself [WHIT-3124]#11218

Open
patrickpatrickpatrick wants to merge 2 commits intomainfrom
prevent-topical-event-self-association
Open

Prevent associating a standard edition with itself [WHIT-3124]#11218
patrickpatrickpatrick wants to merge 2 commits intomainfrom
prevent-topical-event-self-association

Conversation

@patrickpatrickpatrick
Copy link
Contributor

@patrickpatrickpatrick patrickpatrickpatrick commented Mar 9, 2026

What

  • In an association dropdown, exclude the edition if the association type is the same as the edition itself.
  • Raise an error if a topical event is linked to itself

Why

Prevent association of an edition with itself, which might result in a publishing workflow loop.

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

This application is owned by the Whitehall Experience team. Please let us know in #govuk-whitehall-experience-tech when you raise any PRs.

Follow these steps if you are doing a Rails upgrade.

Copy link
Contributor

@ryanb-gds ryanb-gds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is quite a clever solution, but I don't know if the assumption that the container name would be equal to the configurable document type will necessarily hold. Or the assumption that the value will match the document ID.

Having said that, I don't have a better idea of how to solve this. I'd feel safer doing it on the validation side, where we have fuller context (i.e. we validate in the Edition::TopicalEvents concern that the edition isn't referencing itself). Probably one to discuss with the team. I appreciate we don't want to spend too much time on this though as it is an edge case

@patrickpatrickpatrick patrickpatrickpatrick force-pushed the prevent-topical-event-self-association branch 2 times, most recently from 1f3f0a2 to b734c82 Compare March 11, 2026 15:03
In the `select_with_search_tagging` helper, remove the option to
associate an edition with itself if the container name matches
the configurable document type of the edition.
In addition to the frontend interface hiding the option to associate a
topical event with itself, add extra validation to the Topical Event
concern to ensure that the user can't somehow get around this for
safety.
@patrickpatrickpatrick patrickpatrickpatrick force-pushed the prevent-topical-event-self-association branch from b734c82 to 9479405 Compare March 11, 2026 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants