[WHIT-2842] Fix draft locale deletion bug in Publishing API#11012
Merged
Conversation
bfcca2b to
dfa858b
Compare
When changing the primary locale of a draft (e.g. from English to French), the draft for the previous locale was not being discarded in Publishing API, leaving orphaned drafts. This commit: - Captures dirty attributes in `EditionService` before reload. - Passes the previous primary locale to `PublishingApiPusher`. - Upates `PublishingApiPusher` to discard the previous locale draft during `update_draft` event if the primary locale has changed. - Adds regression tests in `DraftLocaleSwitchTest`. Jira: https://gov-uk.atlassian.net/browse/WHIT-2842
dfa858b to
86832ca
Compare
ryanb-gds
reviewed
Jan 19, 2026
Contributor
ryanb-gds
left a comment
There was a problem hiding this comment.
One suggestion to consider, which hopefully might make this a little less complicated if I'm correct
ryanb-gds
approved these changes
Jan 20, 2026
Contributor
ryanb-gds
left a comment
There was a problem hiding this comment.
Any danger in discarding the translation before we update the draft in Publishing API? If the latter fails the preview will be missing but feels like quite a small risk?
Approving on basis that risk is probably minimal, don't merge if you disagree 🙈
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & Why
When changing the primary locale of a draft (e.g. from English to French), the draft for the previous locale was not being discarded in Publishing API, leaving orphaned drafts.
EditionServicebefore reload.PublishingApiPusher.PublishingApiPusherto discard the previous locale draft duringupdate_draftevent if the primary locale has changed.DraftLocaleSwitchTest.Jira: https://gov-uk.atlassian.net/browse/WHIT-2842