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

IMAGEDAM-1400 - Fixing 'Social Media' and 'R&M Photographer - staff' templates #4123

Closed Conalb97 closed 1 year ago

Conalb97 commented 1 year ago

What does this change?

Both the Social Media and R&M Photographer - staff templates were not working as they could not be applied.

This was due to the leases for these templates being undefined as they did not have leases associated with them.

The solution was to add an if-statement on line 153 where the undefined error was occurring, that way a lease is not attempted to be accessed if the template does not contain any.

## How should a reviewer test this change? Add the following to application.conf, to be able to select the 'Social Media' template: metadata.templates = [ { templateName: "Social Media" usageRights: { category: "social-media" restrictions: "SOCIAL MEDIA - Usage requires approval by a Senior Editor" } metadataFields: [ { name: "specialInstructions" value: "Approval needed from a senior editor" resolveStrategy: "replace" } ] } ] To reproduce the issue this PR is fixing: Upload a new image to the grid and select the 'Social Media' template from the templates dropdown. Click the apply button for the template to be applied. The apply button will change to have a 'clock' icon within the button. Attempting to click it now will not work and the changes from the template won't be saved. ![image](https://github.com/guardian/grid/assets/129299738/1a668d64-bda4-46ad-af73-2a40b668a521) To confirm the fix is working: Upload a new image to the grid and select the 'Social Media' template from the templates dropdown. Click the apply button for the template to be applied. The apply button will briefly change to have a 'clock' icon within the button and the changes from the template will be saved. ![image](https://github.com/guardian/grid/assets/129299738/398ed514-0099-4021-98a7-d00d699f8f55)

How can success be measured?

The Social Media and R&M Photographer - staff templates can be successfully applied.

Who should look at this?

@guardian/digital-cms

Tested? Documented?

prout-bot commented 1 year ago

Seen on image-loader, usage, kahuna, media-api (created by @Conalb97 and merged by @paperboyo 11 minutes and 56 seconds ago) Please check your changes!

prout-bot commented 1 year ago

Seen on collections, cropper (created by @Conalb97 and merged by @paperboyo 12 minutes and 2 seconds ago) Please check your changes!

prout-bot commented 1 year ago

Seen on metadata-editor, leases (created by @Conalb97 and merged by @paperboyo 12 minutes and 6 seconds ago) Please check your changes!

prout-bot commented 1 year ago

Seen on auth, thrall (created by @Conalb97 and merged by @paperboyo 12 minutes and 11 seconds ago) Please check your changes!