Review main Merged

86521[BUGFIX] Fix pagetree subtree expansion in search mode

Benjamin Franzke CR +2 V +2 Normal +63 −4 updated 10/10/24, 07:04

Commit message

The TreeController was adapted with #104397 to reduce possibly
unneeded getTreeLevels calls and refactored the condition that
sets the hasChildren flag on a node object.
It turns out that this caused search queries to miss the
hasChildren flag, as the depth pre-condition always evaluated
to false (treeLevelsToFetch is 999 is search-mode).

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
    • Stefan Bürk +1
    • Andreas Kienast +1
    • Oliver Hader +1
  • Verified V +2 Done
    • Benjamin Franzke +2
    • Stefan Bürk +1
    • Andreas Kienast +1
    • Oliver Hader +1
    • core-ci +1 CI

Issues 2

Files 2

Review log 1519

  1. Benjamin Franzke uploaded patch set 1 10/08/24, 16:04

  2. core-ci voted on patch set 1 V -1 10/08/24, 16:13 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/67391

  3. Oliver Hader commented on patch set 1 10/08/24, 16:54

    TreeController.php:411

    `$item['hasChildren']` is the indicator for the JavaScript tree component in v12 (which behaves differently in v13). Thus, just to visual part (since to page-tree information is disclosed here, since `getTreeLevels` was not invoked) it would be fine to just use the following change: ``` if (!empty($page['_children']) || $this->pageTreeRepository->hasChildren($pageId)) { $item['hasChildren'] = true; } ``` * scenario: searching (exactly) for a page that has children * then `$page['_children']` would not have any children (unless they would be matching) * thus only `$this->pageTreeRepository->hasChildren` is used to fill the `$item['hasChildren']` indicator * `$this->pageTreeRepository->getTreeLevels($page, 1);` usually would/should not be invoked in this case
  4. Benjamin Franzke uploaded patch set 2 V -1 10/09/24, 06:29

  5. core-ci voted on patch set 2 V +1 10/09/24, 06:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/67412

  6. Benjamin Franzke commented on patch set 2 10/09/24, 06:38

    TreeController.php:411 Reply

    I'm not sure I get this right: That means you propose to drop the following condition? ``` if ($depth >= $this->levelsToFetch) { $page = $this->pageTreeRepository->getTreeLevels($page, 1); } ``` This was added together with ` || $this->getPageTreeRepository()->hasChildren($pageId)` in https://review.typo3.org/c/Packages/TYPO3.CMS/+/65208/27/typo3/sysext/backend/Classes/Controller/Page/TreeController.php We need to remember: This codepath applied to non-search mode (as searchmode sets `levelsToFetch` to 999 which basically is a opt-out of this condition). To my understanding that'd introduce a new bug on loading the the-filtered pagetree (this codepath is actively used in that case).
  7. Oliver Hader uploaded patch set 3 V +1 10/09/24, 07:49

  8. core-ci voted on patch set 3 V -1 10/09/24, 07:55 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/67414

  9. Benjamin Franzke uploaded patch set 4 V -1 10/09/24, 08:12

  10. Benjamin Franzke commented on patch set 4 10/09/24, 08:12

    TreeController.php:411 Reply

    as discussed, we'll keep this as-before for now.
  11. core-ci voted on patch set 4 V +1 10/09/24, 08:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/67416

  12. Oliver Hader voted on patch set 4 CR +1 10/09/24, 08:55

  13. Andreas Kienast voted on patch set 4 CR +1 10/09/24, 11:19

  14. Andreas Kienast voted on patch set 4 V +1 10/09/24, 11:55

  15. Oliver Hader voted on patch set 4 V +1 10/09/24, 20:55

  16. Stefan Bürk voted on patch set 4 CR +1 10/10/24, 05:55

  17. Stefan Bürk voted on patch set 4 V +1 10/10/24, 06:24

  18. Benjamin Franzke voted on patch set 4 CR +2 V +2 10/10/24, 07:04

  19. Benjamin Franzke merged patch set 5 10/10/24, 07:04