guardian / grid

The Guardian’s image management system
https://www.theguardian.com/info/developer-blog/2015/aug/12/open-sourcing-grid-image-service
Apache License 2.0
1.44k stars 120 forks source link

handle update fn returning false in batch edit #4108

Closed andrew-nowak closed 1 year ago

andrew-nowak commented 1 year ago

What does this change?

the batchUpdateMetadataField function is responsible for managing metadata changes (by delegating to updateMetadataField) and propagating those changes back into the model. If you've selected several images and change a field in such a way that one image has no change to be applied, then updateMetadataField will return false for that image ( this communicates "no change" to angular-xeditable - see this comment https://github.com/guardian/grid/blob/51734b8443d1cafd246818eddde4ea3c36e4a86a/kahuna/public/js/edits/service.js#L257-L269 ). This meant that we now tried to replace the image model with false, which is missing all of the expected fields of an image object causing some UI breakage and some very noisy console logs.

we now catch this case, and return the original image unchanged instead of the false

cc @paperboyo

prout-bot commented 1 year ago

Seen on auth, image-loader, metadata-editor, thrall, leases, cropper, collections, media-api, kahuna (merged by @andrew-nowak 9 minutes and 46 seconds ago) Please check your changes!

prout-bot commented 1 year ago

Seen on usage (merged by @andrew-nowak 9 minutes and 52 seconds ago) Please check your changes!