From 061201856984cd685211a4fa4662d541f69f6034 Mon Sep 17 00:00:00 2001 From: riking Date: Sun, 15 Jun 2014 22:23:54 -0700 Subject: [PATCH] Include the 'textStatus' field in DC.ajax rejection --- app/assets/javascripts/discourse/mixins/ajax.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/mixins/ajax.js b/app/assets/javascripts/discourse/mixins/ajax.js index 4b27624dc46..f6cdbdbf744 100644 --- a/app/assets/javascripts/discourse/mixins/ajax.js +++ b/app/assets/javascripts/discourse/mixins/ajax.js @@ -54,7 +54,7 @@ Discourse.Ajax = Em.Mixin.create({ }; var oldError = args.error; - args.error = function(xhr) { + args.error = function(xhr, textStatus) { // note: for bad CSRF we don't loop an extra request right away. // this allows us to eliminate the possibility of having a loop. @@ -62,9 +62,11 @@ Discourse.Ajax = Em.Mixin.create({ Discourse.Session.current().set('csrfToken', null); } - // If it's a parseerror, don't reject + // If it's a parsererror, don't reject if (xhr.status === 200) return args.success(xhr); + xhr.jqTextStatus = textStatus; + Ember.run(promise, promise.reject, xhr); if (oldError) oldError(xhr); };