core
core copied to clipboard
NavTool method getNav must return only published pages.
Describe the bug When $navtool.getNav("$VTLSERVLET_URI") method is called. It returns unpublished pages as well. Related Ticket: https://dotcms.zendesk.com/agent/tickets/107632 Reproduced on: 22.05
To Reproduce Steps to reproduce the behavior:
- log in to Demo Site.
- Go to Site->Browser portlet.
- Go to application/vtl/carousel directory.
- open banner-carousel.vtl.
- Add the following code.
#set($contextualNav = $navtool.getNav("$VTLSERVLET_URI"))
#if($contextualNav != false)
#foreach($item in $contextualNav)
<li class="level_1#if($item.active) current#end #if($UtilMethods.isSet($item.children)) parent#end"><a
href="${item.href}" data-gtmconversions="subpage">$item.title</a></li>
#end
#end
- Go to the destinations directory.
- Create a new page name 'test' in the destinations directory, and mark the 'show on menu' option.
- Click on the save button (not publish).
- Now go to this page.
- Verify the result unpublished page appears.
Expected behavior When $navtool.getNav is called only published pages must appear in the result set.
Additional context The possible source of the issue is #21385
PR https://github.com/dotCMS/core/pull/22766
Note for QA: Keep in mind that published items should only appear on live pages. That's the main thing. But there are other scenarios that need to be covered when we're in Edit Mode
EDIT MODE + PREVIEW_MODE Should always show non-published stuff
While ADMIN_MODE Behaves like the Live page therefore it should not show non-published items
Our Nav endpoint also needs testing here's an example http://localhost:8080/api/v1/nav/destinations/?depth=3
This endpoint works using the currently selected site
Internal QA: Passed
Fixed, now we are able to see that page just if it is published, if not this is not appearing in live or from front end.
Tested on release-22.10 // Docker // FF
Only Applies to 22.03 LTS