DRYD-2117 Procedure/Object > Ability to set Priority Image - top media priority image as search results thumbnail#556
Conversation
…he media priority list;
mikejritter
left a comment
There was a problem hiding this comment.
@spirosdi hopefully will be able to test this before the end of the day, if not I'll have to tomorrow morning. I left a few comments just from skimming things over, though everything seems good at a glance.
| String collectionObjectCsid; | ||
|
|
||
| if (MEDIA_DOCTYPE.equals(subjectDocType) && COLLECTIONOBJECT_DOCTYPE.equals(objectDocType)) { | ||
| mediaCsid = (String) relationDocModel.getProperty(RELATIONS_COMMON_SCHEMA, SUBJECT_CSID_PROPERTY); |
There was a problem hiding this comment.
Would it make sense to use the media refname here (subjectRefName or objectRefName)? Then below we could do updatedList.remove(mediaRefName) or updatedList.removeAll(List.of(mediaRefName)) if we're concerned about possible duplicates.
| session.saveDocument(collectionObjectDocModel); | ||
|
|
||
| logger.info("Removed media record {} from the media priority list of collectionobject {}", | ||
| mediaCsid, NuxeoUtils.getCsid(collectionObjectDocModel)); |
There was a problem hiding this comment.
We have the CollectionObject csid already so we can reuse it here.
mikejritter
left a comment
There was a problem hiding this comment.
Tested behavior and verified the following:
- Object with multiple related media have deleted csids removed from the media priority list
- When deleting media for an object with a single related media it has no media priority after
Also see the correct media displaying in the grid and list views.
What does this do?
It includes two changes, to make search-result thumbnails be populated according to the media priority order (along the current way). The changes are:
AdvancedSearch.java, check if a collectionobject has a media priority list and pick the top entry as the thumbnail in search results. If the list is empty, the endpoint falls back to the existing behavior.UpdateMediaPriorityOnDelete, that removes entries from media priority list when the media record is unrelated or deleted.Why are we doing this? (with JIRA link)
This is requested in the scope of the https://collectionspace.atlassian.net/browse/DRYD-2117. The record at the top of the Media priority should be the image shown in the grid and detail-list search result views. The listener is added to avoid showing unrelated/deleted media records as thumbnails. https://collectionspace.atlassian.net/browse/DRYD-2141
How should this be tested? Do these changes have associated tests?
Dependencies for merging? Releasing to production?
No dependencies
Has the application documentation been updated for these changes?
Changelog has been updated
Did someone actually run this code to verify it works?
@spirosdi ran it locally
Have any new security vulnerabilities been handled?
No new vulns