FIX: respect `logout_redirect` setting on 'Log out all'

FIX: respect logout_redirect setting on ‘Log out all’

diff --git a/app/assets/javascripts/discourse/controllers/preferences/account.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/account.js.es6
index ac56e0e..64b8262 100644
--- a/app/assets/javascripts/discourse/controllers/preferences/account.js.es6
+++ b/app/assets/javascripts/discourse/controllers/preferences/account.js.es6
@@ -228,7 +228,17 @@ export default Ember.Controller.extend(
             type: "POST",
             data: token ? { token_id: token.id } : {}
           }
-        );
+        ).then(() => {
+          if (!token) {
+            const redirect = this.siteSettings.logout_redirect;
+            if (Ember.isEmpty(redirect)) {
+              window.location.pathname = Discourse.getURL("/");
+            } else {
+              window.location.href = redirect;
+            }
+          }
+        })
+        .catch(popupAjaxError);
       },
 
       showToken(token) {

GitHub sha: e4d74391

1 Like