Bug #88054
closedA content element visible in a workspace, is not visibile when it's hidden in LIVE
100%
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
Files
Updated by Robert Vock over 5 years ago
The method getRecordOverlay also has this bug. It ignores hidden elements and does not load the overlay:
PageRepository.php:587
Updated by Riccardo De Contardi over 5 years ago
- Related to Bug #85003: Workspace : no content show in preview frontend, if live page is hidden added
Updated by Riccardo De Contardi over 4 years ago
- Related to Bug #80995: Content of hidden page not shown in workspace preview added
Updated by Riccardo De Contardi over 4 years ago
This issue is still present on 10.4.0-dev
Tested with these steps:
Prerequisites:¶
- TYPO3 with a DRAFT workspace
Test procedure¶
1) Create a page in LIVE version, enable it
2) Create a "Content-1" content element
3) Create a "Content-2" content element below the first one, hide it
Result so far (on backend)
Content-1
Content-2 (hidden)
4) Switch to DRAFT workspace
5) Preview the page in WS
Result so far (preview):
Only Content-1 is visible
6) Enable Content-2 (Still in DRAFT workspace)
7) Preview the page in WS
Result so far (preview):
Content-1 is visible
Content-2 is visible
8) Drag and drop Content-2 above Content-1
9) Preview
Results (preview):¶
Content-2 is NOT visible
Content-1 is visible
Updated by Danilo Caccialanza over 4 years ago
- File Issue 88054 TYPO3.f4v Issue 88054 TYPO3.f4v added
I want to warn you that this problem is not resolved with patch made for related issues.
I atached at this post a video that explain the problem.
Thanks
Updated by Danilo Caccialanza over 4 years ago
Danilo Caccialanza wrote:
I want to warn you that this problem is not resolved with patch made for related issues.
I atached at this post a video that explain the problem.
Thanks
And I confirm that Gianluca workaround works, I have been using his patch in production for a long time :)
Updated by Benni Mack over 4 years ago
Danilo Caccialanza wrote:
Danilo Caccialanza wrote:
I want to warn you that this problem is not resolved with patch made for related issues.
I atached at this post a video that explain the problem.
ThanksAnd I confirm that Gianluca workaround works, I have been using his patch in production for a long time :)
Hey all,
can you share the whole method of `PageRepository->movePlhOL()` please?
Updated by Danilo Caccialanza over 4 years ago
- File PageRepository.zip PageRepository.zip added
- File PageRepository.php PageRepository.php added
Hi Benny,
i send you attached the patch for the file typo3/sysext/frontend/Classes/Page/PageRepository.php
Its an extratfrom our extension core patch, some code can be remved...
Thanks !! :)
Updated by Gerrit Code Review over 4 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/64620
Updated by Gerrit Code Review over 4 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/64620
Updated by Benni Mack over 4 years ago
Hey Danilo,
Thank you very much. Please review this change https://review.typo3.org/c/Packages/TYPO3.CMS/+/64620 and add your vote to it (+1 on testing and +1 on reviewing) if it works for you. If it does, we can bring it back to v10 and v9!
Updated by Benni Mack over 4 years ago
- Related to Bug #67001: Workspace Pagepreview doesn't work, if the livepage is set to hidden=1 added
Updated by Danilo Caccialanza over 4 years ago
Hi Benni
I tried the your patch on 10.4.3 and it works perfectly.
On 9.5.18 the patch it would seem not work.
I noticed that the path of file PageRepository.php in v10 is "/typo3/sysext/*core*/Classes/Domain/Repository/PageRepository.php" and in v9 is "/typo3/sysext/*frontend*/Classes/Page/PageRepository.php", I don't know if it's an important thing.
it would be nice if it could also work on v9 :)
Now I add my vote at review.typo3.org.
Thanks
Updated by Gerrit Code Review over 4 years ago
Patch set 1 for branch 10.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/64632
Updated by Benni Mack over 4 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 561f95ba7874c9d4c1c0b64bfb44bc86dfb8d09c.
Updated by Gerrit Code Review over 4 years ago
- Status changed from Resolved to Under Review
Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/64630
Updated by Benni Mack over 4 years ago
- Status changed from Under Review to Resolved
Applied in changeset f3e4dc32bdd760eeaf63db2219948db70815a110.
Updated by Benni Mack over 4 years ago
Danilo Caccialanza wrote:
Hi Benni
I tried the your patch on 10.4.3 and it works perfectly.
Hey Danilo,
could you also re-test this patch for v9? https://review.typo3.org/c/Packages/TYPO3.CMS/+/64630
Updated by Danilo Caccialanza over 4 years ago
Hey Benni,
i re-test more carefully the patch for v9, it vorks alo in v9!!
you are the best!
Updated by Benni Mack over 4 years ago
Danilo Caccialanza wrote:
Hey Benni,
i re-test more carefully the patch for v9, it vorks alo in v9!!
you are the best!
Hey Danilo,
that's great. Thanks a LOT for your testing and providing the support for making this happen so quickly! Great contribution. Thanks so much!