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 121 forks source link

Fixing bug where metadata-validity and image-cost-message controls don't update correctly when usage rights category is modified. #4297

Closed AndyKilmory closed 2 months ago

AndyKilmory commented 3 months ago

What does this change do?

There is currently a bug such that if a user is viewing an image and updates the usage rights category in the metadata panel and adds some restrictions text to the image on save of the updates to the rights category the warning panels metadata-validity and image-cost-message do not display - i.e. they are not getting updated correctly on changes in usage rights category and restrictions. (refreshing the screen will correct the display). The same problem occurs in reverse - if restrictions are removed from an image the visibility of the restrictions panel and the warning panel above it does not update (ie they remain visibile when they should be hidden).

This PR corrects this issue by 'listening' on $rootScope for the 'images-updated' message and updating both controls to relfect the new image information.

Initial state: Screenshot 2024-07-08 at 12 23 26

after restrictions removed and saved...

Screenshot 2024-07-08 at 12 24 15

after refresh...

Screenshot 2024-07-08 at 12 26 44

How should a reviewer test this change?

Ensure that the correct restriction information is displayed in the metadata panel after the restrictions text linked to the image has either been added or removed.

Who should look at this?

Tested? Documented?

paperboyo commented 3 months ago

Tested in our TEST env, this fixes not only Info panel in Browser and Viewer, but also badges on thumbnails! Thank you!

prout-bot commented 2 months ago

Seen on auth, usage, image-loader, metadata-editor, thrall, leases, cropper, collections, media-api, kahuna (created by @AndyKilmory and merged by @paperboyo 8 minutes and 39 seconds ago) Please check your changes!