Conversation
|
Claude finished @oidacra's task in 1m 38s —— View job Code ReviewThe fix is correct. One line change, right diagnosis. A few things worth flagging: Missing test for the reported scenario (inode lookup) The bug title and description specifically call out "fetching by inode without an explicit
// PageRenderUtil.java line 422
ContentUtils.addRelationships(contentlet, user, mode, languageId);Here No test teardown Neither test has Second test relies on implicit config state
The core fix is sound and the tests verify the right behavior. The gaps above are worth addressing before merge. |
…ead of session language When fetching content by inode with depth parameter, the relationship hydration was using the session/request language (defaulting to language 1) instead of the actual contentlet's language. This caused relationship fields to return content in the default language even when viewing a localized version. Closes #34289
a6823ac to
0bd551b
Compare
Rollback Safety AnalysisResult: ✅ Safe To Rollback I analyzed the diff against all rollback-unsafe categories in Change reviewed:
Category assessment:
Conclusion: This is a pure in-memory logic fix. No DB migrations, no ES mapping changes, no API contract changes, and no serialization model changes. Rolling back to N-1 is safe — the only effect would be reverting to the previous (buggy) behavior where relationship fields used session language instead of contentlet language. Label |
…lationship hydration with fallback language This commit introduces a new integration test class, `ContentResourceIntegrationTest`, which verifies that relationships are correctly hydrated using the contentlet's language when fetching content with a non-default language. The test ensures that the fallback mechanism works as intended, addressing issues where relationships were previously hydrated using the request's language instead. Additionally, the `MainSuite1b` test suite is updated to include this new test class. Closes #34289
Summary
depthparameter onGET /api/v1/content/{inodeOrIdentifier}languagequery param, the backend derivedlanguageIdfrom the session (defaulting to language 1). The contentlet itself was resolved correctly via inode, but relationship hydration used the session language instead of the contentlet's actual language.contentlet.getLanguageId()instead of the request-derivedlanguageIdwhen callingContentUtils.addRelationships, ensuring relationships are always hydrated in the same language as the contentlet being returned.Closes #34289
Acceptance Criteria
Test Plan
?depth=2→ verify relationship returns English child?depth=2→ verify relationship returns Spanish child (previously returned English)?language=2&depth=2→ verify relationship returns Spanish childChanged Files
dotCMS/src/main/java/com/dotcms/rest/api/v1/content/ContentResource.java— Line 415: ChangedlanguageId→contentlet.getLanguageId()This PR fixes: #34289