From 0415bce80d188654446b58efd0d32513e18a92ba Mon Sep 17 00:00:00 2001
From: Andreas Fernandez <a.fernandez@scripting-base.de>
Date: Wed, 18 Nov 2015 08:55:39 +0100
Subject: [PATCH] [BUGFIX] Restore clear cache menu icon if clearing fatals

Currently, the clear cache icon in the top menu only gets restored when
the clearing process was successful. If the call fails for whatever
reason, the spinner is shown until the backend is reloaded.

Change the "success" handler to "complete" to always restore the
original icon.

Resolves: #71630
Releases: master
Change-Id: I6c3758411ebb1802cd95ce09f9e74b3f888f0e59
Reviewed-on: https://review.typo3.org/44766
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Daniel Lorenz <forge@extco.de>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
---
 .../Resources/Public/JavaScript/Toolbar/ClearCacheMenu.js     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ClearCacheMenu.js b/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ClearCacheMenu.js
index e6dbc4366372..572754174bc9 100644
--- a/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ClearCacheMenu.js
+++ b/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ClearCacheMenu.js
@@ -48,7 +48,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Icons'], function($, Icons) {
 
 	/**
 	 * calls TYPO3 to clear a cache, then changes the topbar icon
-	 * to a spinner. Once done, restores the original topbar icon
+	 * to a spinner. Restores the original topbar icon when the request completed.
 	 *
 	 * @param {String} ajaxUrl the URL to load
 	 */
@@ -67,7 +67,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Icons'], function($, Icons) {
 			url: ajaxUrl,
 			type: 'post',
 			cache: false,
-			success: function() {
+			complete: function() {
 				$(ClearCacheMenu.options.toolbarIconSelector, ClearCacheMenu.options.containerSelector).replaceWith($existingIcon);
 			}
 		});
-- 
GitLab