[BUGFIX] Repair depth selection in workspace module 95/60495/3
authorDaniel Goerz <daniel.goerz@posteo.de>
Wed, 17 Apr 2019 17:40:08 +0000 (19:40 +0200)
committerDaniel Goerz <daniel.goerz@posteo.de>
Thu, 18 Apr 2019 06:48:45 +0000 (08:48 +0200)
This patch fixes a regression introduced with
https://review.typo3.org/#/c/Packages/TYPO3.CMS/+/60492/

Resolves: #43338
Releases: master, 9.5
Change-Id: I3ac8445ec21097531ff1dcb5e33d0ff271332be3
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60495
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Daniel Sattler <sattler@b13.de>
Tested-by: Daniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Daniel Sattler <sattler@b13.de>
Reviewed-by: Achim Fritz <af@achimfritz.de>
Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de>
typo3/sysext/workspaces/Resources/Public/JavaScript/Backend.js

index 54b6686..0da8b7a 100644 (file)
@@ -69,11 +69,15 @@ define([
   };
 
   Backend.initialize = function() {
+    var persistedDepth = Persistent.get('Workspaces.Module.depth');
     Backend.getElements();
     Backend.registerEvents();
 
-    if (Persistent.get('Workspaces.Module.depth') > 0) {
-      Backend.elements.$depthSelector.val(Persistent.get('Workspaces.Module.depth'));
+    if (persistedDepth > 0) {
+      Backend.elements.$depthSelector.val(persistedDepth);
+      Backend.settings.depth = persistedDepth;
+    } else {
+      Backend.settings.depth = TYPO3.settings.Workspaces.depth;
     }
 
     Backend.loadWorkspaceComponents();
@@ -217,8 +221,9 @@ define([
 
     // Listen for depth changes
     Backend.elements.$depthSelector.on('change', function(e) {
-      var $me = $(this);
-      Persistent.set('Workspaces.Module.depth', $me.val());
+      var depth = $(this).val();
+      Persistent.set('Workspaces.Module.depth', depth);
+      Backend.settings.depth = depth;
       Backend.getWorkspaceInfos();
     });