[WIP] Support lead image opt out [WHIT-2801]#11220
Draft
ChrisBAshton wants to merge 8 commits intomainfrom
Draft
[WIP] Support lead image opt out [WHIT-2801]#11220ChrisBAshton wants to merge 8 commits intomainfrom
ChrisBAshton wants to merge 8 commits intomainfrom
Conversation
… 'type' lead, with 'sources'
To ensure a consistent image payload across types, we are bringing the lead image payload in line with that of the other non-embeddable images, such as topical events' headers and logos, and history pages' sidebar.
The change is from sending a singular `details.image` to sending `details.images` with a `type` to identify the `usage`, and a hash of `sources` corresponding to the various image variants, rather than the `url`, `high_resolution_url`, `medium_resolution_url` we were sending prior. Since the code is scoped to config-driven document types, this change only affects news articles. History pages have been dealt with separately, and republished.
This change is accompanied by changes in publishing API, Frontend, and the metadata component (which looks for a url). All these changes will require a 2-step release: an expand to allow both payloads, then a contract after republishing. All news articles will require republishing for the change to take effect.
Note on the payload specifics:
- We have agreed with Frontend owners that, in order to keep the API consistent, and the FE code relatively simple, we will send the `sources` hash with all the variant keys, even for cases where the image is not truly "versioned". In the case of lead images, that's the placeholder image, which we now send replicated for all the versions ("default" kind's versions: s960, s712, s630, s465, s300, s216). This also ensures the system can expand in the future, if we then provide a versioned placeholder image. This is in line with what we do for svg images elsewhere, which only generate one asset variant.
Note on `FeaturedImageData` changes:
- I had to compute a `sources` payload for the `FeaturedImageData` since that's the model underlying the fallback organisation image. The `publishing_api_details` method sits on the `Image` model for regular images, so it would have made sense to put it on the "parent" model for `FeaturedImageData` as well, i.e. `Organisation` in this case. Nonetheless, there are many models using this `_Data` class, not just `Organisation`, so it is more convenient to place it straight on the `FeaturedImageData` for the time being.
- We can reconsider this at a later stage when more `FeatureImageData` usages need to be made consistent with this new payload shape, so I have made no attempts to unify concerns at this point.
55ef0c7 to
c8a6692
Compare
When editions are created and they get the default lead image, the link to 'Add' a lead image is a little confusing, as there is already one - the default. The designs in the ticket suggest we use the word 'Replace' instead.
We're about to make the logic more complex, so let's set a good foundation to iterate from.
c8a6692 to
1004b80
Compare
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
This PR adds user journeys to opt out of ("Remove") the default lead image, and opt back in ("Use default image"), alongside the usual custom lead image journey.
I've followed the designs in Confluence
Why
This follows a commitment we've already made to publishers for config-driven news articles.
Jira: https://gov-uk.atlassian.net/browse/WHIT-2801
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.