This issue occurs when using either Content Moderation/Workflows or Workbench Moderation.
Steps to reproduce:
1) Set up workflows for a content type so that you have a draft and publish option (which is default)
2) Add a paragraph type that has another nested paragraph underneath it
3) Add content of that type and set the status to published
4) Make changes to the nested paragraph, but save the node as a DRAFT
5) The above actually causes the nested paragraph type to automatically be set to the content moderation status of published instead of respecting the parent paragraph, which in this example is draft.
Essentially, nested paragraphs always are being set to published with the workflows/content moderation module.
Comment | File | Size | Author |
---|---|---|---|
#23 | ParagraphsContentModerationNestedTest.php_.txt | 7.51 KB | sleitner |
#21 | 2949412-21.patch | 1.83 KB | Abyss |
#21 | 2949412-21.diff | 1.51 KB | Abyss |
Issue fork paragraphs-2949412
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
Comment #2
miro_dietikerI don‘t get the scenario.
You never set a paragraph to unpublished, thus it‘s published.
The host node entity moderation workflow should not influence the paragraphs published status at all.
Access to paragraphs is checked by delegating access checks to the host.
The published status of a paragraph is to hide such a paragraph for a given version. If i review a node with 5 pararaphs published and 2 unpublished for internal notes, i want the 5 published and the 2 need to remain unpublished on releasing that revision.
Comment #3
BerdirWell, the thing is that the paragraph references just the parent ID, not the revision. So it references the default revision, that is accessible and published, so is the paragraphs.
That should only be a problem if paragraphs are displayed on their own, in most cases you should just render the parent node with its fields. However, some uses case like private file access are indeed broken then.
The only way to address that is to start tracking the parent revision ID as well..
Comment #4
brettboylen CreditAttribution: brettboylen commentedComment #5
brettboylen CreditAttribution: brettboylen as a volunteer commentedBerdir, exactly. Last week before I saw your response, we also tracked it down specifically to what you stated, that it isn't actually tracking the parent revision ID.
This is probably something that should be fixed sometime in the future. If we solve it in-house with a patch, I'll post the patch here. We may just take an alternate approach to our use-case scenario, however, for the time-being.
Comment #6
miro_dietikerMoving this to the content moderation parent.
Comment #7
miro_dietikerPromoting according to roadmap.
Comment #8
charginghawk CreditAttribution: charginghawk commentedI'd just like to note this is an issue when creating a view of paragraphs with a "published" filter. It then presents content from published and unpublished nodes regardless.
Comment #9
miro_dietiker@charginghawk Not sure if this is related. The views integration needs work (mostly test coverage) and note that the Paragraph entity intentionally has a published base field as well independent of the node published one.
Comment #10
brettboylen CreditAttribution: brettboylen as a volunteer and commentedEDIT: My apologies, didn't mean to make this post, was trying to add a comment on another issue.
Comment #11
rudam CreditAttribution: rudam commentedI'm also having this issue.
Cant edit paragraphs inside a node in draft revision. If I give the user permission to edit "published" content the paragraphs then gets editable.
Any luck on this?
Comment #12
andy_w CreditAttribution: andy_w at Numiko commentedI had the same issue using content moderation with paragraphs. I ended up extending the AccessHandler with a custom module and then adding in the ModerationInformation service, and then using that to retrieve the latest revision to check access on (as this is the revision being edited).
Although obviously the better solution would be to store the revision on the paragraph.
Comment #13
kencyong CreditAttribution: kencyong commentedHi there, I'm having this problem using Workbench Moderation, it's a real bummer. Anybody have any kind of solution to this?
Comment #14
Poindexterous CreditAttribution: Poindexterous commentedI'm using paragraph blocks with layout builder (with content moderation, too). This setup is complicated by the fact that we need custom blocks to wrap the paragraphs in order to use them in layout builder. So the custom block is the parent. I ran into an issue where the parent revision ID is needed to properly process the permission checks before render. I was hit by this issue pretty hard in the scenario where we had a published revision and a draft revision being juggled simultaneously. I don't have a perfect solution yet (highly experimental and I'm not very familiar with Paragraphs's code), but as a workaround I'm using a query to look up which revisions on the parent block hold the paragraph in question, and then load that parent entity with the correct revision id to pass along to the permission check.
In the paragraphAccessControlHandler check access method I'm using the following query:
You should be able to get the correct parent's revision ID from that query, but I don't know if there are any scenarios where one would expect multiple results- then it begs the question on which revision is the right one. I'm still tinkering with this.
Comment #15
lucasantunes CreditAttribution: lucasantunes commentedI don't think we should be checking the Parent's revision id. Instead, it should be "as simple as", when saving a parent, propagating its Moderation Status to all of its children. More specifically, its ERR children. For that reason, I believe this issue should be worked on the ERR project, not here, if that makes any sense.
That'll be of huge utility for a use case of ours where we wanna display only the latest approved (not in Draft) ERR children. Ex: Node VID 1000 (published) points to Child 1 -> RID 50; Child 2 -> RID 50. Node VID 1001 (Draft) points to Child 1 -> RID 51; Child 2 -> RID 51. In this use case, children shown should be RID 50, not 51, but since they're always published, we get 51 instead.
Comment #16
SrinuPodamekala CreditAttribution: SrinuPodamekala commentedHi Team,
I have a content type called products. I have enabled content moderation and workflow module and I am using multilingual website.
In the products content type, I have used nested paragraphs. Now I have created new product and using workflow process I have published the product.
Now if I update/modify the content in that product it becomes draft state from publish state and if I see it only in the latest version tab we can see the updated/modified content. the previous version content will not visible to public until and unless it is published. It is working fine for normal fields(node fields) but when it comes to nested paragraph, it is directly visible to public even the previous version content is in draft version.
I have created the paragraph field using Entity reference revisions.
Also I have verified that if I set the paragraph type as paragraph classic, it is working fine in the manage form display but if I set the type as inline entity form - complex, it is not working as except.
Please help me on this.
Comment #17
SrinuPodamekala CreditAttribution: SrinuPodamekala commented@miro_dietiker, Can you please help me on this.
Comment #19
Abyss CreditAttribution: Abyss at DevBranch, Drupal Ukraine Community for Forum One commentedComment #21
Abyss CreditAttribution: Abyss at DevBranch, Drupal Ukraine Community for Forum One commentedI fixed incorrect paragraph work with content moderation, but for end work on this issue will need tests update, 'cause they were written for the previous logic.
Comment #22
Abyss CreditAttribution: Abyss at DevBranch, Drupal Ukraine Community for Forum One commentedComment #23
sleitner CreditAttribution: sleitner commentedI tried to build a test for this issue following the steps in the summary. I must be missing something, because the test doesn't fail as expected. See test file attached.
Comment #24
amateescu CreditAttribution: amateescu for Tag1 Consulting commented#2954512: Store information about a paragraph's parent revision would fix this problem, so closing it as a duplicate.