Issue Bug Closed

#88054A content element visible in a workspace, is not visibile when it's hidden in LIVE

Gianluca Strafella 04/02/19, 11:56 updated 09/29/20, 15:07

Description

Hi,
in these conditions:

1) Two (or more) content elements in a standard page, in LIVE:
Content-1: sorting=1, hidden=0
Content-2: sorting=2, hidden=1 (this content is not visibile in LIVE)

2) A user, in a workspace, actives Content-2 Content-1: sorting=1, hidden=0
Content-2: sorting=2, hidden=0 (content now showed in current workspace)

3) The same user, moves Content-2 above Content-1:
Content-1: sorting=2, hidden=0
Content-2: sorting=1, hidden=0 (content now showed in current workspace)

At this point, “Content-2” is not more visibile on frontend, also if is still visible (hidden=0).

I found a problem in class \TYPO3\CMS\Frontend\Page\PageRepository::movePlhOL

around first query:

//...
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table);

//this row exclude the live record because it is hidden in LIVE
$queryBuilder->setRestrictions(GeneralUtility::makeInstance(FrontendRestrictionContainer::class));

$origRow = $queryBuilder->select(...array_keys($this->purgeComputedProperties($row)))
//...

The FrontendRestrictionContainer include HiddenRestriction, but in this case, the content element is still hidden in LIVE.

As workaround, I patched the core, rewriting the class and overwriting the method, with this replacements:

//original statement
//$queryBuilder->setRestrictions(GeneralUtility::makeInstance(FrontendRestrictionContainer::class));

//replaced with
$queryBuilder->removeAll()
             ->add(GeneralUtility::makeInstance(DeletedRestriction::class))
             ->add(GeneralUtility::makeInstance(FrontendWorkspaceRestriction::class))
             ->add(GeneralUtility::makeInstance(StartTimeRestriction::class))
             ->add(GeneralUtility::makeInstance(EndTimeRestriction::class))
             ->add(GeneralUtility::makeInstance(FrontendGroupRestriction::class));

The problem has been replicated on these TYPO3 versions:
- TYPO3 8.7.24
- TYPO3 9.5

Thank you,
Gianluca

Reviews 3