Summary
The language-selection picker's localizedView permission filtering is dead code — it never actually restricts the offered languages.
Details
PermissionBasedLanguageSelectionControl → WithElementContext (assets/js/src/core/modules/element/components/language-selection/type/with-element-context.tsx) does:
const elementDraft = useElementDraft(...)
if ('permissions' in elementDraft) {
const permissions = elementDraft.permissions ...
// filter user.contentLanguages by permissions.localizedView
}
But useElementDraft (core/modules/element/hooks/use-element-draft.ts) returns { ...draft, element: draft.asset|dataObject|document, editorType, isLoading, isError } — permissions live under elementDraft.element.permissions (IElementDraft.permissions), not at the top level. So 'permissions' in elementDraft is always false, the filter branch never runs, and the control always offers all of the user's content languages regardless of the element's localizedView permission.
Impact
Anywhere PermissionBasedLanguageSelectionControl is used (grid column config, language comparison, etc.), languages the user has no localizedView permission for are still shown/selectable. This is a behaviour bug, not just cosmetic.
Suggested fix
Read elementDraft.element?.permissions?.localizedView (with the existing "default"/empty fallbacks). Because this changes the picker's behaviour across all element types, it should be done as its own change with QA against a user whose localizedView is narrower than their content languages — deliberately out of scope for the batch-edit multi-locale PR (#3899), which now uses user.contentLanguages directly (matching what the picker actually shows today).
Also noticed (separate, minor)
In the asset batch-edit modal (asset/listing/batch-actions/batch-edit-modal/batch-edit-modal.tsx), the error useEffect reads isFolderPatchError/folderPatchError but its dependency array is [isError, isFolderPatchSuccess], so a folder-patch failure may not be reported. Pre-existing; worth a small dependency-array fix.
Summary
The language-selection picker's
localizedViewpermission filtering is dead code — it never actually restricts the offered languages.Details
PermissionBasedLanguageSelectionControl→WithElementContext(assets/js/src/core/modules/element/components/language-selection/type/with-element-context.tsx) does:But
useElementDraft(core/modules/element/hooks/use-element-draft.ts) returns{ ...draft, element: draft.asset|dataObject|document, editorType, isLoading, isError }— permissions live underelementDraft.element.permissions(IElementDraft.permissions), not at the top level. So'permissions' in elementDraftis alwaysfalse, the filter branch never runs, and the control always offers all of the user's content languages regardless of the element'slocalizedViewpermission.Impact
Anywhere
PermissionBasedLanguageSelectionControlis used (grid column config, language comparison, etc.), languages the user has nolocalizedViewpermission for are still shown/selectable. This is a behaviour bug, not just cosmetic.Suggested fix
Read
elementDraft.element?.permissions?.localizedView(with the existing "default"/empty fallbacks). Because this changes the picker's behaviour across all element types, it should be done as its own change with QA against a user whoselocalizedViewis narrower than their content languages — deliberately out of scope for the batch-edit multi-locale PR (#3899), which now usesuser.contentLanguagesdirectly (matching what the picker actually shows today).Also noticed (separate, minor)
In the asset batch-edit modal (
asset/listing/batch-actions/batch-edit-modal/batch-edit-modal.tsx), the erroruseEffectreadsisFolderPatchError/folderPatchErrorbut its dependency array is[isError, isFolderPatchSuccess], so a folder-patch failure may not be reported. Pre-existing; worth a small dependency-array fix.