Closed davisagli closed 1 year ago
@davisagli thanks for creating this Pull Request and helping to improve Plone!
TL;DR: Finish pushing changes, pass all other checks, then paste a comment:
@jenkins-plone-org please run jobs
To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.
Happy hacking!
Name | Link |
---|---|
Latest commit | 5b47b1f0b88fa5c9e17a41df42c9b4eeaeca1545 |
Latest deploy log | https://app.netlify.com/sites/plone-restapi/deploys/649a20131c79dd0008d3aeeb |
@pnicolli My worry about backwards compatibility is this: The resolveuid serializer will process any field with the name url
, even in custom blocks. So we can break them if those blocks suddenly start getting objects instead of strings there, and aren't expecting it.
Options for avoiding that:
{
"url": "/path/to/image",
"image_scales": { ... }
}
@pnicolli I updated this to keep the url
as a string and put image_scales
at the same level -- but I haven't had time to try it with volto yet.
@davisagli thanks! I will give it a try today.
I tried pulling this branch and running my frontend branch against this, created an image block, saved it and image data is sent correctly by the rest api, so everything looks good!
Also tried replacing the image in the Image object and I am getting the correct new scales 👍
@jenkins-plone-org please run jobs
@jenkins-plone-org please run jobs
Tested this again with https://github.com/plone/volto/pull/3337 and it works fine for me.
@jenkins-plone-org please run jobs
@tisto Okay with you if I go ahead and merge this? I tested it in the context of our big project and didn't see any regressions.
@davisagli @tisto If you are ok, I will merge and release this.
This adds
image_scales
while serializing blocks (in the same serialization transform that handles resolveuid URLs), in order to support rendering images with asrcset
(https://github.com/plone/volto/pull/3337)image_scales
is added at the same level as theurl
or@id
key. That way the only change to the existing data structure is adding a new key, which should be backwards compatible in most cases.