fix(content): resolve relationship field save failure on Translate Manually#36178
Conversation
…nually When translating content via "Translate Manually", saving failed with HTTP 500 if a related contentlet had no version in the target language. Two root causes: - RelationshipUtil.filterContentlet threw a NullPointerException when findContentletForLanguage returned null; it now falls back to findContentletByIdentifierAnyLanguage (relationships are stored at the identifier level) and skips with a warning if nothing is found. - ESContentletAPIImpl.getContentletRelationships threw a ClassCastException when the contentlet map held the raw comma-separated UUID String set by MapToContentletPopulator instead of a List<Contentlet>; it now inspects the runtime type and resolves the String via RelationshipUtil.filterContentlet, catching DotStateException as well. Adds integration coverage in RelationshipUtilTest (language fallback, missing identifier) and ESContentletAPIImplTest (String relationship value with language fallback, and empty-string clearing). fixes: #35862 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
❌ Codex Review failed —
|
|
Claude finished @erickgonzalez's task in 1m 41s —— View job Rollback Safety Analysis
Result: ✅ Safe To RollbackAll 9 changed files were evaluated against every category in the rollback-unsafe reference. No unsafe category was matched.
Categories checked (all clear):
The label "AI: Safe To Rollback" has been applied. |
…editor Follow-up to the Translate Manually save fix. When viewing a contentlet in the new Edit Contentlet, the relationship field only listed related items that had a version in the viewed language; items existing only in other languages were silently dropped, and multilingual related items could be duplicated. Relationships are stored per identifier in the tree table, so all related items must be listed regardless of the viewed language, each exactly once, preserving the saved order. Mirrors how the legacy edit screen (ContentletAjax) resolved related content: one working version per related identifier, language-agnostic, in tree_order. - ContentResource.getContent opts into a new languageFallback flag when adding relationships; frontend page render, GraphQL and pull keep per-language filtering (flag defaults off). - ContentUtils.addRelationships and ContentHelper.addRelationshipsToJSON gain default-off overloads carrying the flag (existing signatures preserved); the flag is threaded into both the main and self-relationship call sites and is NOT propagated into the nested depth 2/3 calls. - New ContentHelper.resolveRelatedLanguageAgnostic resolves one row per related identifier (dedup by identifier preserving tree_order), preferring the viewed language version and falling back to any available version, then filters by READ permission so the fallback cannot surface unreadable content. Adds ContentUtilsTest coverage (fallback listing, multilingual no-duplicate, order preservation) and a ContentResourceV1 Postman case. fixes: #35862 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🤖 Bedrock Review —
|
When translating content via "Translate Manually", saving failed with HTTP 500 if a related contentlet had no version in the target language. Two root causes:
Adds integration coverage in RelationshipUtilTest (language fallback, missing identifier) and ESContentletAPIImplTest (String relationship value with language fallback, and empty-string clearing).
fixes: #35862
This PR fixes: #35862