Validate in ValidHierarchyReferenceConstraintValidator should bypass non default entity revisions

Created on 16 January 2023, about 2 years ago
Updated 18 January 2023, about 2 years ago

Problem/Motivation

This entity node cannot be referenced as it is either a child or the same entity.

Steps to reproduce

Setup a simple workflow with Draft, Needs Review, Published, Archived.
In Basic page node type enable "Create new revision" in publishing option and add field_parent as an Entity reference hierarchy field.

Step 1. Create 'Page Test' then save daft.
Step 2. Create 'Page Test 1' and in field_parent select 'Page Test' then save daft.
Step 3. Create 'Page Test 2' and in field_parent select 'Page Test' then save daft.
Step 4. Edit 'Page Test 2' and in field_parent remove 'Page Test' then save draft.
Step 5. Edit 'Page Test' and in field_parent select 'Page Test 2' then try to save the node => The error show up in field_parent field with message "This entity node cannot be referenced as it is either a child or the same entity."

Proposed resolution

We may need to update validate method in ValidHierarchyReferenceConstraintValidator to exclude non default revisions of children.
Same what we did with loadEntitiesForTreeNodesWithoutAccessChecks in EntityTreeNodeMapper.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

3.0

Component

Code (module)

Created by

🇻🇳Vietnam tannguyenhn

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024