fix(content-drive): truncate long-text field values in listing rows (#37185) - #37396
fix(content-drive): truncate long-text field values in listing rows (#37185)#37396ihoffmann-dot wants to merge 5 commits into
Conversation
Red confirmed: LongTextPreviewStrategy/TransformOptions.LONG_TEXT_PREVIEW don't exist yet, so the test class doesn't compile.
…37185) Adds TransformOptions.LONG_TEXT_PREVIEW (declared after STORY_BLOCK_VIEW/ JSON_VIEW so EnumSet order runs it last) backed by LongTextPreviewStrategy, which replaces WYSIWYG/TextArea/Story Block values with a <=150-char extracted plain-text preview. Wired opt-in only at BrowserAPIImpl#dotContentMap via a new DotTransformerBuilder#longTextPreview() chain method -- never added to defaultOptions, so no other transformer consumer is affected.
…preview (#37185, AC-008) If a content type's title-source field is itself WYSIWYG/TextArea (its variable is literally 'title'), LongTextPreviewStrategy would match it by field type and clobber the value COMMON_PROPS already populated from Contentlet#getTitle() with a truncated/HTML-stripped preview. Skip the 'title' key explicitly.
…w trim (#37185) T030-T033: generic-Content row shape from getPaginatedContents (Drive) and getFolderContent (Site Browser) both carry AC-002's required keys and reduced long-text values; Show In List (AC-003) renders a readable preview; a WYSIWYG title-source field (AC-008) keeps an untruncated title. Also: AC-005 Schema description update on ContentDriveResource#search (endpoint is @hidden, no openapi.yaml regen needed), and AC-006 Postman fix removing the dead item.body read (a listing row never carried that key) in favor of an assertion that actually runs.
|
Claude finished @ihoffmann-dot's task in 2m 26s —— View job Code Review — PR #37396
The design is sound: A few non-blocking items: New Issues
No blocking issues — the Medium items are polish/perf on an already-correct implementation. |
…gyTest/BrowserAPITest (#37185) - defaultOptions_neverIncludesLongTextPreview referenced DotContentletTransformerImpl.defaultOptions directly across packages (...transform vs. this test's ...transform.strategy) -- the field is package-private, so it doesn't compile. Read it via reflection instead. - The wysiwygTitleField test's long title HTML (400+ chars) exceeded the contentlet.title column's varchar(255) limit. Reduced while keeping the stripped plain text well over the 150-char preview bound. - REQUIRED_LISTING_KEYS listed the actual icon key as '__icon__' (it's 'icon') and included mimeType/extension, which are File Asset-specific and legitimately absent on a generic-Content row.
Summary
TransformOptions.LONG_TEXT_PREVIEW(declared afterSTORY_BLOCK_VIEW/JSON_VIEWsoEnumSetiteration order runs it last) backed by a newLongTextPreviewStrategy.BrowserAPIImpl#dotContentMapvia a newDotTransformerBuilder#longTextPreview()chain method — never added todefaultOptions, so no other transformer consumer (Content Editor,ContentResource, GraphQL, asset picker) is affected (AC-007).title), the strategy would have overwritten the already-correct, untruncated titleCOMMON_PROPScomputes. Fixed by explicitly skipping thetitlekey.@Schemadescription onContentDriveResource#search(AC-005; endpoint is@Hidden, noopenapi.yamlregen needed) and removes a deaditem.bodyassertion in the Postman collection (AC-006, a listing row never carried that key).Test plan
./mvnw test -pl :dotcms-core -Dtest=LongTextPreviewStrategyTestjust test-integration-ide./mvnw verify -pl :dotcms-integration -Dcoreit.test.skip=false -Dit.test=BrowserAPITest./mvnw verify -pl :dotcms-postman -Dpostman.test.skip=false -Dpostman.collections=ContentDriveResourceSystem.out/System.getProperty/System.getenvintroduced (checked via diff)Branched off the approved spec branch per this repo's Spec-Kit flow (spec.md-only in PR1, not merged to
mainyet).🤖 Generated with Claude Code
This PR fixes: #37185
Verification (2026-09-04, local)
LongTextPreviewStrategyTest) pass.BrowserAPITest) pass.ContentDriveResourcecollection) pass.Bugs found and fixed in the test code along the way (not the production fix): a package-private field access across packages (fixed via reflection), a test title exceeding the
contentlet.titlecolumn'svarchar(255)limit, an incorrect expected key name (__icon__vs. the realicon) plus two File-Asset-only keys (mimeType/extension) wrongly expected on a generic-Content row.