[BUGFIX] Abort `nodeSelectedAfter` on unchecked nodes 36/57836/4
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Wed, 8 Aug 2018 20:39:41 +0000 (22:39 +0200)
committerTymoteusz Motylewski <t.motylewski@gmail.com>
Tue, 4 Sep 2018 07:37:03 +0000 (09:37 +0200)
If a node in the page tree is clicked, the `nodeSelectedAfter` event is
triggered for any active node that is being deactivated.

The event listener is now aborted if the event is called on a unchecked
node.

Resolves: #85787
Releases: master
Change-Id: I4fa5bbc4290b5ffd2ecb77a901dceb042dff3d27
Reviewed-on: https://review.typo3.org/57836
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Paweł Rogowicz <rogowicz.pawel@gmail.com>
Tested-by: Paweł Rogowicz <rogowicz.pawel@gmail.com>
Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
typo3/sysext/backend/Resources/Public/JavaScript/PageTree/PageTree.js

index 5797f00..17b85f8 100644 (file)
@@ -190,6 +190,9 @@ define(['jquery',
      * @param {Node} node
      */
     PageTree.prototype.nodeSelectedAfter = function(node) {
+      if (!node.checked) {
+        return;
+      }
       //remember the selected page in the global state
       fsMod.recentIds.web = node.identifier;
       fsMod.currentBank = node.stateIdentifier.split('_')[0];
@@ -307,8 +310,6 @@ define(['jquery',
       }
 
       var _this = this;
-      var checked = node.checked;
-
       var selectedNodes = this.getSelectedNodes();
       selectedNodes.forEach(function (node) {
         if (node.checked === true) {