[BUGFIX] Make sure that mass actions actually process all changes 96/55896/3
authorBenedikt Huß <benedikt.huss@werkdigital.de>
Wed, 28 Feb 2018 08:37:12 +0000 (09:37 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 28 Feb 2018 12:12:45 +0000 (13:12 +0100)
Evaluate number of total items and trigger subsequent requests to
process the remaining items, so that all changes are actually
processed.

Resolves: #84037
Releases: master, 8.7
Change-Id: I92f388b50328320973abcc290de52083f05655dd
Reviewed-on: https://review.typo3.org/55896
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/workspaces/Resources/Public/JavaScript/Backend.js

index b5f344f..505d510 100644 (file)
@@ -1045,6 +1045,20 @@ define([
       $('<p />').html(TYPO3.lang['tooltip.' + selectedAction + 'All'] + '<br><br>' + TYPO3.lang['tooltip.affectWholeWorkspace']),
       Severity.warning
     );
+
+    var sendRequestsUntilAllProcessed = function(response) {
+      var result = response[0].result;
+      // Make sure to process all items
+      if (result.processed < result.total) {
+        Workspaces.sendRemoteRequest(
+          Workspaces.generateRemoteMassActionsPayload(massAction, result)
+        ).done(sendRequestsUntilAllProcessed);
+      } else {
+        Backend.getWorkspaceInfos();
+        Wizard.dismiss();
+      }
+    }
+
     Wizard.addFinalProcessingSlide(function() {
       Workspaces.sendRemoteRequest(
         Workspaces.generateRemoteMassActionsPayload(massAction, {
@@ -1054,15 +1068,7 @@ define([
           language: Backend.settings.language,
           swap: doSwap
         })
-      ).done(function(response) {
-        var payload = response[0].result;
-        Workspaces.sendRemoteRequest(
-          Workspaces.generateRemoteMassActionsPayload(massAction, payload)
-        ).done(function() {
-          Backend.getWorkspaceInfos();
-          Wizard.dismiss();
-        });
-      });
+      ).done(sendRequestsUntilAllProcessed);
     }).done(function() {
       Wizard.show();