[PAGES-1407] subnodes should not be included in a json response for inherited node that is filtered out by the predicateClass Created: 06/Oct/23  Updated: 14/Dec/23  Resolved: 21/Nov/23

Status: Closed
Project: Magnolia pages module
Component/s: None
Affects Version/s: None
Fix Version/s: 6.3.0, 6.2.33

Type: Bug Priority: Neutral
Reporter: Riste Drangovski Assignee: Canh Nguyen
Resolution: Fixed Votes: 0
Labels: None
Σ Remaining Estimate: 0d Remaining Estimate: 0d
Σ Time Spent: 1d 0.5h Time Spent: 1d 0.5h
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Attachments: Java Source File ExtendedFilteredInheritancePredicate.java     PNG File how-jcr-store.png     PNG File image-2023-10-10-11-37-11-323.png     PNG File image-2023-10-10-11-39-04-668.png     PNG File image-2023-10-10-11-39-39-592.png     PNG File image-2023-10-10-11-40-57-467.png     PNG File output-when-enable-true-for-parent.png     PNG File output-when-setting-enable.png     PNG File set-enable-true.png     PNG File set-inheritable-false.png    
Issue Links:
dependency
depends upon MAGNOLIA-9145 Subnodes should not be included in a ... Closed
documentation
to be documented by DOCU-2926 DOC: Extend the inheritance propertie... Closed
Sub-Tasks:
Key
Summary
Type
Status
Assignee
PAGES-1443 Implement Sub-task Completed Canh Nguyen  
PAGES-1444 Review Sub-task Completed Chuong Doan Huy  
PAGES-1445 piQA Sub-task Closed Anh Vu  
PAGES-1446 QA Sub-task Completed Chuong Doan Huy  
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[X]* Steps to reproduce, expected, and actual results filled
[X]* Affected version filled
Release notes required:
Yes
Documentation update required:
Yes
Date of First Response:
Epic Link: Support
Sprint: DevX 50, DevX 51
Story Points: 3
Team: DeveloperX
Work Started:
Approved:
Yes

 Description   

Currently if we exclude a node from inheritance with filter predicate ( using predicateClass property of inheritance definition) his child nodes are still added to the json response.

Expected behavior would be that once node is filtered out by the filter predicate all it's child nodes to be excluded from inheritance. 



 Comments   
Comment by Oanh Thai Hoang [ 10/Oct/23 ]

Hi rdrangovski .

 

I'm in process of discovery this ticket and tried to reproduce this bug.

Could you elaborate your use case a bit because I can't reproduce for now

 

Here is how I set up:

Prepare a predicate class: ExtendedFilteredInheritancePredicate.java. This is just a very simple predicate that evaluate a node has inheritable property is true. It means evaluate node will be failed when inheritable property is false or does not exist

 

Prepare a ** dialog has complex structure for dialog: basic-with-composite

 

label: Basic With Composite
form:
  properties:
    composite:
      label: Title composite
      $type: compositeField
      itemProvider:
        $type: jcrChildNodeProvider
      properties:
        title:
          label: Title
          $type: textField
        inherit:
          name: inheritable
          $type: checkBoxField
          label: Inherit
          buttonLabel: Inherited by Subpages
          defaultValue: false
        composite-city:
          label: City subnode composite
          $type: compositeField
          itemProvider:
            $type: jcrChildNodeProvider
          properties:
            city:
              label: city
              $type: textField 

 

 

Set inheritance true, and set predicateClass for template like below:

 

 

inheritOnNestedAreaWithComposite:
  title: Inherit ON (Nested Area With Composite)
  dialog: inherit-lm:components/basic-with-composite
  inheritance:
    enabled: true
    components: all
    predicateClass: info.magnolia.pages.spa.predicates.ExtendedFilteredInheritancePredicate 

 

 

Now set inheritable is true for parent page

This is how it look like for parent page

 

 

This is how JCR of parent look like:

 

And json response when executing child page:

 

Because inheritable is true so evaluate node from predicate class is true that why json show inherited nodes.

 

And then when I set inheritable is false in parent page like below:  

 

And json response when executing child page still show as my expectation. I don't see inherited composite node and his child from parent (composite_inherited_depth_4, composite-city_inherited_depth_5)

 

I'm looking for your response. 

 

Thank you

Comment by Riste Drangovski [ 10/Oct/23 ]

Here is one example where component filtering is not working properly:

We have:

  • footer area
      - footer component
        - link list area
          - link list component

Footer component is inherited:

Link list component is not inherited:

Json response includes "Link list" component that should not be inherited (should be filtered out):

So as far as I see there is definitely a problem with the inheritance filter in the delivery endpoint!

Comment by Oanh Thai Hoang [ 11/Oct/23 ]

Thank rdrangovski . I can reproduce your case now. 

Comment by Canh Nguyen [ 21/Nov/23 ]

Note for docs: In case of a nested area in a component, we should config the area inheritance information similar to page's areas. Without configuration, it will work like before without filtering.

Generated at Mon Feb 12 06:27:55 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.