Problem/Motivation

When translations on paragraphs are enabled, a common tactic is to allow different translations to "mutate" by allowing the published field to be translatable. This allows the English version to show one paragraph, and the French one to hide it.

While some the ParagraphAccessControlHandler handles some of this, AccessResult::allowedIf() returns *neutral* when the test fails, and not Forbidden. This allows unpublished a paragraphs to appear if no one explicitly forbids them.

paragraphs_type_permissions_paragraph_access() is the one place in Paragraphs where AccessResult::forbidden() is returned. Therefore, this hook needs to check if we're not on the default translation before querying for published status.

Oddly, this is only a bug for *anon*, as it works logged in.

Steps to reproduce

Enable translations on paragraph entities (not the paragraph items field).
Enable the status field on the paragraph to be translatable.
Create a node in the default language with a set of paragraphs.
Translate the node into the target language, unpublish a key paragraph.
Refresh cache.
View the translated node as anon.

Proposed resolution

Alter paragraphs_type_permissions_paragraph_access() to get the translation when necessary.

Remaining tasks

Create patch.

User interface changes

None.

API changes

None.

Data model changes

None.

Issue fork paragraphs-3607214

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

socketwench created an issue. See original summary.

socketwench’s picture

Status: Active » Needs review