From ce942fe324016f1399cd2499a41f2ffa4ae80a85 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 6 Aug 2014 16:16:29 +1000 Subject: [PATCH] FIX: never cache ajax GET requests unless specified --- app/assets/javascripts/discourse/mixins/ajax.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/mixins/ajax.js b/app/assets/javascripts/discourse/mixins/ajax.js index 990e64d37f5..ff832e9d759 100644 --- a/app/assets/javascripts/discourse/mixins/ajax.js +++ b/app/assets/javascripts/discourse/mixins/ajax.js @@ -72,6 +72,10 @@ Discourse.Ajax = Em.Mixin.create({ if (!args.type) args.type = 'GET'; if (!args.dataType && args.type.toUpperCase() === 'GET') args.dataType = 'json'; + if (args.type === 'GET' && args.cache !== true) { + args.cache = false; + } + $.ajax(Discourse.getURL(url), args); }; @@ -79,7 +83,7 @@ Discourse.Ajax = Em.Mixin.create({ // request (bypass for GET, not needed) if(args.type && args.type.toUpperCase() !== 'GET' && !Discourse.Session.currentProp('csrfToken')){ return Ember.Deferred.promise(function(promise){ - $.ajax(Discourse.getURL('/session/csrf')) + $.ajax(Discourse.getURL('/session/csrf'), {cache: false}) .success(function(result){ Discourse.Session.currentProp('csrfToken', result.csrf); performAjax(promise);