Conversation
…items have images Show thumbnail/icon for all relationship items when at least one item has a title image, matching the existing content picker dialog behavior. Items without images show the content type icon as placeholder. Closes #35258
|
Claude finished @oidacra's task in 1m 16s —— View job Review
Three things worth a second look: 1. The
(item.hasTitleImage as unknown) === 'true'This cast is needed because 2. The computed runs over 3. Tests use
hasTitleImage: 'true' as unknown as booleanThis works, but it's a test-only workaround for the same model type issue in point 1. If the model type is fixed, these casts go away naturally and the tests become cleaner. Otherwise the change is clean. The copilot-flagged string coercion bug was correctly handled with explicit |
|
Rollback Safety Analysis complete. Label added: AI: Safe To Rollback. All changes are pure frontend Angular (HTML template, signal store, unit tests) with no database, ES mapping, API contract, or OSGi changes. Safe to rollback. |
There was a problem hiding this comment.
Pull request overview
Updates the Edit Content Relationships field table to render a consistent thumbnail/icon area across rows when at least one related item has a title image, using a store-level computed signal to drive the UI.
Changes:
- Added a
showThumbnailcomputed signal in the relationship field store to decide when to render the thumbnail/icon area. - Updated the relationship table template to use
showThumbnailinstead of a per-rowhasTitleImagecheck (and adjusted spacing). - Added unit tests validating
showThumbnailbehavior for empty data, no images, and mixed images.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-relationship-field/store/relationship-field.store.ts | Adds showThumbnail computed signal based on whether any item has a title image. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-relationship-field/store/relationship-field.store.spec.ts | Adds unit tests for showThumbnail. |
| core-web/libs/edit-content/src/lib/fields/dot-edit-content-relationship-field/components/dot-relationship-field/dot-relationship-field.component.html | Uses store-level showThumbnail to render thumbnails/icons for all rows when enabled. |
Comments suppressed due to low confidence (1)
core-web/libs/edit-content/src/lib/fields/dot-edit-content-relationship-field/components/dot-relationship-field/dot-relationship-field.component.html:126
- This change gates rendering of the thumbnail/icon area on
store.showThumbnail(). That means for relationships where no items have a title image, the table will show no icon column at all (text only). The linked issue’s acceptance criteria calls for an icon column on every row with a generic fallback when the icon is unavailable; if that’s still the requirement, this conditional rendering won’t satisfy it.
<div class="flex items-center gap-3">
@if (showThumbnail) {
<div
class="w-20 h-14 flex-shrink-0 rounded-md overflow-hidden bg-gray-100">
<dot-contentlet-thumbnail
[iconSize]="'24px'"
[contentlet]="item"
[playableVideo]="false"
data-testId="contentlet-thumbnail" />
</div>
}
<p class="truncate">{{ item.title }}</p>
...content/src/lib/fields/dot-edit-content-relationship-field/store/relationship-field.store.ts
Outdated
Show resolved
Hide resolved
...nt/src/lib/fields/dot-edit-content-relationship-field/store/relationship-field.store.spec.ts
Show resolved
Hide resolved
Some API endpoints return hasTitleImage as a string ('true'/'false')
instead of a boolean. Use explicit equality checks to avoid treating
the string 'false' as truthy, matching dot-contentlet-thumbnail logic.
…ationship field store The production build fails with TS2367 because hasTitleImage is typed as boolean but was also compared against the string 'true'.
…s for hasTitleImage
Summary
showThumbnailcomputed signal to the store with unit testsCloses #35258
Changes
dot-relationship-field.component.htmlhasTitleImagecheck with store-levelshowThumbnailsignal; increase gap between thumbnail and titlerelationship-field.store.tsshowThumbnailcomputed:data.some(item => item.hasTitleImage)relationship-field.store.spec.tsshowThumbnail(no images, mixed images, empty data)Acceptance Criteria
hasTitleImageis false (handled bydot-contentlet-thumbnailweb component)showThumbnailcomputed signalTest Plan
Visual Changes
Note
Low Risk
Low risk UI/state change limited to relationship field rendering; main risk is minor visual/layout regressions due to new computed
showThumbnailcondition.Overview
Updates the relationship field table so the title column renders the thumbnail/icon area for all rows whenever any item in the relationship has a title image, rather than deciding per-row, matching picker behavior.
Adds a store-level computed signal
showThumbnail(treatinghasTitleImageas boolean or string) with new unit tests to cover mixed/empty data scenarios, and slightly increases spacing between thumbnail and title.Reviewed by Cursor Bugbot for commit 420ef09. Bugbot is set up for automated code reviews on this repo. Configure here.
This PR fixes: #35258