Skip to content

DRYD-2117 Procedure/Object > Ability to set Priority Image - top media priority image as search results thumbnail#556

Open
spirosdi wants to merge 3 commits into
developfrom
feature/dryd-2117-populate-as-blobinfo-from-media-priority-top-entry
Open

DRYD-2117 Procedure/Object > Ability to set Priority Image - top media priority image as search results thumbnail#556
spirosdi wants to merge 3 commits into
developfrom
feature/dryd-2117-populate-as-blobinfo-from-media-priority-top-entry

Conversation

@spirosdi

Copy link
Copy Markdown
Contributor

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:

  • In 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.
  • A new event listener 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?

  1. Create a collectionobject related to two or more media records (with blobs), and set the Media Priority order so the top record is not the alphabetically-first one by title.
  2. Search for the object in the staff UI. The grid and detail-list thumbnails should show the top-priority record's image.
  3. Search for an object with related media but no priority list. The thumbnail should be unchanged (legacy title-sort behavior).
  4. Unrelate the top-priority media record. It should disappear from the object's Media Priority panel, and the thumbnail should shift to the next entry.
  5. Delete a top-priority media record. Same result to unrelate.

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

@spirosdi
spirosdi requested a review from mikejritter July 22, 2026 16:17

@mikejritter mikejritter left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, done!

session.saveDocument(collectionObjectDocModel);

logger.info("Removed media record {} from the media priority list of collectionobject {}",
mediaCsid, NuxeoUtils.getCsid(collectionObjectDocModel));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have the CollectionObject csid already so we can reuse it here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@spirosdi
spirosdi requested a review from mikejritter July 23, 2026 11:34

@mikejritter mikejritter left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants