Skip to content
Snippets Groups Projects
Commit bc6ccceb authored by Christian Kuhn's avatar Christian Kuhn
Browse files

[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: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
parent d7d3f6fd
Branches
Tags
No related merge requests found
...@@ -17,11 +17,11 @@ declare(strict_types=1); ...@@ -17,11 +17,11 @@ declare(strict_types=1);
namespace TYPO3\CMS\Workspaces\Controller\Remote; namespace TYPO3\CMS\Workspaces\Controller\Remote;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\View\BackendViewFactory; use TYPO3\CMS\Backend\View\BackendViewFactory;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\DataHandling\DataHandler; use TYPO3\CMS\Core\DataHandling\DataHandler;
use TYPO3\CMS\Core\Http\ServerRequest;
use TYPO3\CMS\Core\Localization\LanguageService; use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility; use TYPO3\CMS\Core\Utility\MathUtility;
...@@ -756,7 +756,7 @@ class ActionHandler ...@@ -756,7 +756,7 @@ class ActionHandler
* Fetch the current label and visible state of the stage buttons. * 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. * 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 // Fetch next and previous stage
$workspaceItemsArray = $this->workspaceService->selectVersionsInWorkspace( $workspaceItemsArray = $this->workspaceService->selectVersionsInWorkspace(
...@@ -768,8 +768,7 @@ class ActionHandler ...@@ -768,8 +768,7 @@ class ActionHandler
); );
[, $nextStage] = $this->stagesService->getNextStageForElementCollection($workspaceItemsArray); [, $nextStage] = $this->stagesService->getNextStageForElementCollection($workspaceItemsArray);
[, $previousStage] = $this->stagesService->getPreviousStageForElementCollection($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($request, ['typo3/cms-workspaces']);
$view = $this->backendViewFactory->create(new ServerRequest(), ['typo3/cms-workspaces']);
$view->assignMultiple([ $view->assignMultiple([
'enablePreviousStageButton' => is_array($previousStage) && !empty($previousStage), 'enablePreviousStageButton' => is_array($previousStage) && !empty($previousStage),
'enableNextStageButton' => is_array($nextStage) && !empty($nextStage), 'enableNextStageButton' => is_array($nextStage) && !empty($nextStage),
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment