From bc6ccceb361dcb713cca47da0e8e0035a366697d Mon Sep 17 00:00:00 2001 From: Christian Kuhn <lolli@schwarzbu.ch> Date: Wed, 30 Aug 2023 16:21:22 +0200 Subject: [PATCH] [BUGFIX] Fix stage changing in workspace preview Changing stages using the various buttons in workspace preview module fatals server side since the request is incomplete. This is mainly due to the weird ajax dispatching from class AjaxDispatcher to ActionHandler: This area needs a major overhaul. However, patch for issue #100577 already introduced a hack to hand the current request down. The patch re-uses this to fix the issue. Resolves: #101802 Related: #101781 Related: #96904 Related: #100577 Releases: main, 12.4 Change-Id: Ifacf653ed0409891469a168c7bc0c38eaacf183f Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80690 Tested-by: core-ci <typo3@b13.com> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> --- .../workspaces/Classes/Controller/Remote/ActionHandler.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/typo3/sysext/workspaces/Classes/Controller/Remote/ActionHandler.php b/typo3/sysext/workspaces/Classes/Controller/Remote/ActionHandler.php index 84465def9a4d..cb141f5227a9 100644 --- a/typo3/sysext/workspaces/Classes/Controller/Remote/ActionHandler.php +++ b/typo3/sysext/workspaces/Classes/Controller/Remote/ActionHandler.php @@ -17,11 +17,11 @@ declare(strict_types=1); namespace TYPO3\CMS\Workspaces\Controller\Remote; +use Psr\Http\Message\ServerRequestInterface; use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Backend\View\BackendViewFactory; use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; use TYPO3\CMS\Core\DataHandling\DataHandler; -use TYPO3\CMS\Core\Http\ServerRequest; use TYPO3\CMS\Core\Localization\LanguageService; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\MathUtility; @@ -756,7 +756,7 @@ class ActionHandler * Fetch the current label and visible state of the stage buttons. * Used when records have been pushed to different stages in the preview module to update the button phalanx. */ - public function updateStageChangeButtons(int $id): string + public function updateStageChangeButtons(int $id, ServerRequestInterface $request): string { // Fetch next and previous stage $workspaceItemsArray = $this->workspaceService->selectVersionsInWorkspace( @@ -768,8 +768,7 @@ class ActionHandler ); [, $nextStage] = $this->stagesService->getNextStageForElementCollection($workspaceItemsArray); [, $previousStage] = $this->stagesService->getPreviousStageForElementCollection($workspaceItemsArray); - // @todo: It would of course be better if AjaxDispatcher could hand over $request to the method ... - $view = $this->backendViewFactory->create(new ServerRequest(), ['typo3/cms-workspaces']); + $view = $this->backendViewFactory->create($request, ['typo3/cms-workspaces']); $view->assignMultiple([ 'enablePreviousStageButton' => is_array($previousStage) && !empty($previousStage), 'enableNextStageButton' => is_array($nextStage) && !empty($nextStage), -- GitLab