[TASK] Get rid of special fePreview=2 for workspaces 87/55887/3
authorBenni Mack <benni@typo3.org>
Sat, 24 Feb 2018 17:30:44 +0000 (18:30 +0100)
committerBenni Mack <benni@typo3.org>
Sun, 25 Feb 2018 20:52:42 +0000 (21:52 +0100)
If a workspace is being previewed, the check does not have a kasper'sche boolean
value (0,1,2) anymore, as the detection of a workspace is handled via a
separate method $this->doWorkspacePreview() anyways.

Resolves: #84035
Releases: master
Change-Id: Ia169df138ef827ead6bee6d88a78d1543a977941
Reviewed-on: https://review.typo3.org/55887
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
typo3/sysext/frontend/Classes/Hooks/FrontendHooks.php
typo3/sysext/workspaces/Classes/Hook/TypoScriptFrontendControllerHook.php

index 2c43ac4..26917ba 100644 (file)
@@ -252,8 +252,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface
     /**
      * Flag indication that preview is active. This is based on the login of a
      * backend user and whether the backend user has read access to the current
-     * page. A value of 1 means ordinary preview, 2 means preview of a non-live
-     * workspace
+     * page.
      * @var int
      */
     public $fePreview = 0;
@@ -1111,10 +1110,9 @@ class TypoScriptFrontendController implements LoggerAwareInterface
                 $this->fePreview = 1;
                 $this->showHiddenPage = true;
             }
-            // The preview flag will be set if a backend user is in an offline workspace
+            // The preview flag will be set if an offline workspace will be previewed
             if ($this->whichWorkspace() > 0) {
-                // Will show special preview message.
-                $this->fePreview = 2;
+                $this->fePreview = 1;
             }
             // If the front-end is showing a preview, caching MUST be disabled.
             if ($this->fePreview) {
@@ -1272,7 +1270,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface
         $timeTracker->push('fetch_the_id initialize/', '');
         // Initialize the page-select functions.
         $this->sys_page = GeneralUtility::makeInstance(PageRepository::class);
-        $this->sys_page->versioningPreview = $this->fePreview === 2 || (int)$this->workspacePreview || (bool)GeneralUtility::_GP('ADMCMD_view');
+        $this->sys_page->versioningPreview = $this->whichWorkspace() > 0 || (bool)GeneralUtility::_GP('ADMCMD_view');
         $this->sys_page->versioningWorkspaceId = $this->whichWorkspace();
         $this->sys_page->init($this->showHiddenPage);
         // Set the valid usergroups for FE
index ef8025e..09dd582 100644 (file)
@@ -29,7 +29,7 @@ class FrontendHooks
      */
     public function hook_previewInfo($params, $pObj)
     {
-        if ($pObj->fePreview !== 1) {
+        if (!$pObj->fePreview || $pObj->doWorkspacePreview()) {
             return '';
         }
         if ($pObj->config['config']['message_preview']) {
index a5c8ad9..edbce85 100644 (file)
@@ -40,8 +40,7 @@ class TypoScriptFrontendControllerHook
      */
     public function renderPreviewInfo(array $params, \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $pObj)
     {
-        // 2 means preview of a non-live workspace
-        if ($pObj->fePreview !== 2) {
+        if (!$pObj->doWorkspacePreview()) {
             return '';
         }