Bug #88054

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

Added by Gianluca Strafella about 2 years ago. Updated 9 months ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Workspaces
Target version:
-
Start date:
2019-04-02
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.2
Tags:
workspace sorting
Complexity:
Is Regression:
Sprint Focus:

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

Issue 88054 TYPO3.f4v (16.3 MB) Issue 88054 TYPO3.f4v Danilo Caccialanza, 2020-05-28 08:02
PageRepository.zip (1.71 KB) PageRepository.zip Danilo Caccialanza, 2020-05-28 11:08
PageRepository.php (4.62 KB) PageRepository.php Danilo Caccialanza, 2020-05-28 11:08

Related issues

Related to TYPO3 Core - Bug #85003: Workspace : no content show in preview frontend, if live page is hiddenClosed2018-05-14

Actions
Related to TYPO3 Core - Bug #80995: Content of hidden page not shown in workspace previewClosed2017-04-25

Actions
Related to TYPO3 Core - Bug #67001: Workspace Pagepreview doesn't work, if the livepage is set to hidden=1Closed2015-05-17

Actions
#1

Updated by Robert Vock about 2 years ago

The method getRecordOverlay also has this bug. It ignores hidden elements and does not load the overlay:
PageRepository.php:587

#2

Updated by Riccardo De Contardi about 2 years ago

  • Related to Bug #85003: Workspace : no content show in preview frontend, if live page is hidden added
#3

Updated by Riccardo De Contardi about 1 year ago

  • Related to Bug #80995: Content of hidden page not shown in workspace preview added
#4

Updated by Riccardo De Contardi about 1 year 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

#5

Updated by Danilo Caccialanza about 1 year ago

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

#6

Updated by Danilo Caccialanza about 1 year 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 :)

#7

Updated by Benni Mack about 1 year 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.
Thanks

And 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?

#8

Updated by Danilo Caccialanza about 1 year ago

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 !! :)

#9

Updated by Gerrit Code Review about 1 year 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

#10

Updated by Gerrit Code Review about 1 year 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

#11

Updated by Benni Mack about 1 year 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!

#12

Updated by Benni Mack about 1 year ago

  • Related to Bug #67001: Workspace Pagepreview doesn't work, if the livepage is set to hidden=1 added
#13

Updated by Danilo Caccialanza about 1 year 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

#14

Updated by Gerrit Code Review about 1 year 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

#15

Updated by Benni Mack about 1 year ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#16

Updated by Gerrit Code Review about 1 year 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

#17

Updated by Benni Mack about 1 year ago

  • Status changed from Under Review to Resolved
#18

Updated by Benni Mack about 1 year 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

#19

Updated by Danilo Caccialanza about 1 year ago

Hey Benni,

i re-test more carefully the patch for v9, it vorks alo in v9!!

you are the best!

#20

Updated by Benni Mack about 1 year 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!

#21

Updated by Benni Mack 9 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF