[MAGNOLIA-4011] Exclusion of nodes not working on inheritable page components Created: 07/Mar/12  Updated: 19/Feb/13  Resolved: 19/Apr/12

Status: Closed
Project: Magnolia
Component/s: core
Affects Version/s: 4.5
Fix Version/s: 4.5.3

Type: Bug Priority: Major
Reporter: Federico Grilli Assignee: Tobias Mattsson
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
duplicate
is duplicated by MGNLSTK-939 Targeting content to a channel works ... Closed
relation
is related to MGNLSTK-1095 Escape values for rendering, don't es... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

Exclusion on components more fine-grained than page seems not to work in the context of a page. I.e. exclude /mysite/mypage/promos/0
from a given channel. Direct requests to that content correctly return 404 when the channel is matched. Requests to /mysite/mypage, on the contrary, will show the excluded node even if the channel is matched. The wrapping to filter components based on the current channel is done at {{ info.magnolia.rendering.renderer.AbstractRenderer#wrapWithChannelVisibilityWrapper()}}. It seems it has to do with inheritance because, i.e. it works on teasers area (not inheritable) components in STK's demo-project home page and not on promos area (inheritable) on the same page.



 Comments   
Comment by Federico Grilli [ 29/Mar/12 ]

These are my current findings:
info.magnolia.templating.elements.AreaElement line #246 the call to NodeUtil.getNodes(..) triggers the evaluation of ChannelVisibilityPredicate in case the current areaNode isn't inherited. When inherited the node is wrapped with info.magnolia.templating.inheritance.DefaultInheritanceContentDecorator which isnt extending info.magnolia.jcr.decoration.NodePredicateContentDecorator and thus the predicate evaluation isnt triggered. I was looking at DefaultInheritanceContentDecorator and got lost a bit, I am afraid that let it simply extend NodePredicateContentDecorator isn't what we want. Needs to be discussed with or handed over to Tobias.

Comment by Tobias Mattsson [ 19/Apr/12 ]

The problem is that the wrapper which excludes content based on the channel is applied in the renderer and passed to the template and the model. But in AggregationState/RenderingContext the content is available unwrapped. When an area is rendered the AreaElement which is invoked by the area directive takes the content from AggregationState and thus uses the unwrapped one.

The reason it works for some areas is that AreaElement can also be given a node explicitly in the template. It is taken from the wrapped one given to the template by the renderer.

The solution is to always place a wrapped node in AggregationState/RenderingContext before the template is rendered. This way it won't matter from where AreaElement takes the node.

Generated at Mon Feb 12 03:51:48 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.