mirror of
https://github.com/discourse/discourse.git
synced 2025-02-20 18:58:10 +00:00
DEV: Remove cache
option from ajax()
(#13142)
1. It defaults to `cache: true` already 2. Setting it to `false` for non-GET request doesn't do anything 3. We were correcting `cache: false` GET requests to use `cache: true` …so setting it to anything at all, for any type of request doesn't make sense (anymore)
This commit is contained in:
parent
ccbe3bea79
commit
e06a206131
@ -366,7 +366,7 @@ export default Component.extend({
|
||||
},
|
||||
|
||||
_buildPayload(facets) {
|
||||
let payload = { data: { cache: true, facets } };
|
||||
let payload = { data: { facets } };
|
||||
|
||||
if (this.startDate) {
|
||||
payload.data.start_date = moment(this.startDate)
|
||||
|
@ -162,10 +162,6 @@ export function ajax() {
|
||||
args.headers["Discourse-Script"] = true;
|
||||
}
|
||||
|
||||
if (args.type === "GET" && args.cache !== true) {
|
||||
args.cache = true; // Disable JQuery cache busting param, which was created to deal with IE8
|
||||
}
|
||||
|
||||
ajaxObj = $.ajax(getURL(url), args);
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,6 @@ function searchTags(term, categories, limit) {
|
||||
function () {
|
||||
oldSearch = $.ajax(getURL("/tags/filter/search"), {
|
||||
type: "GET",
|
||||
cache: true,
|
||||
data: { limit: limit, q },
|
||||
});
|
||||
|
||||
|
@ -99,7 +99,6 @@ export default function loadScript(url, opts) {
|
||||
ajax({
|
||||
url: fullUrl,
|
||||
dataType: "text",
|
||||
cache: true,
|
||||
}).then(cb);
|
||||
} else {
|
||||
// Always load JavaScript with script tag to avoid Content Security Policy inline violations
|
||||
|
@ -156,7 +156,6 @@ export default class {
|
||||
|
||||
ajax("/topics/timings", {
|
||||
data,
|
||||
cache: false,
|
||||
type: "POST",
|
||||
headers: {
|
||||
"X-SILENCE-LOGGER": "true",
|
||||
|
@ -141,7 +141,7 @@ const Bookmark = RestModel.extend({
|
||||
url += "?" + $.param(params);
|
||||
}
|
||||
|
||||
return ajax(url, { cache: "false" });
|
||||
return ajax(url);
|
||||
},
|
||||
|
||||
loadMore(additionalParams) {
|
||||
|
@ -172,7 +172,6 @@ const Post = RestModel.extend({
|
||||
|
||||
return ajax(`/posts/${this.id}/recover`, {
|
||||
type: "PUT",
|
||||
cache: false,
|
||||
})
|
||||
.then((data) => {
|
||||
this.setProperties({
|
||||
|
@ -66,7 +66,7 @@ export default RestModel.extend({
|
||||
|
||||
this.set("loading", true);
|
||||
|
||||
return ajax(findUrl, { cache: "false" })
|
||||
return ajax(findUrl)
|
||||
.then((result) => {
|
||||
if (result && result.no_results_help) {
|
||||
this.set("noContentHelp", result.no_results_help);
|
||||
|
@ -50,7 +50,7 @@ export default EmberObject.extend({
|
||||
|
||||
this.set("loading", true);
|
||||
|
||||
return ajax(this.url, { cache: false })
|
||||
return ajax(this.url)
|
||||
.then((result) => {
|
||||
if (result) {
|
||||
const posts = result.map((post) => UserAction.create(post));
|
||||
|
@ -100,7 +100,7 @@ export default RestModel.extend({
|
||||
}
|
||||
|
||||
this.set("loading", true);
|
||||
return ajax(findUrl, { cache: "false" })
|
||||
return ajax(findUrl)
|
||||
.then((result) => {
|
||||
if (result && result.no_results_help) {
|
||||
this.set("noContentHelp", result.no_results_help);
|
||||
|
@ -524,27 +524,23 @@ const User = RestModel.extend({
|
||||
|
||||
loadUserAction(id) {
|
||||
const stream = this.stream;
|
||||
return ajax(`/user_actions/${id}.json`, { cache: "false" }).then(
|
||||
(result) => {
|
||||
if (result && result.user_action) {
|
||||
const ua = result.user_action;
|
||||
return ajax(`/user_actions/${id}.json`).then((result) => {
|
||||
if (result && result.user_action) {
|
||||
const ua = result.user_action;
|
||||
|
||||
if (
|
||||
(this.get("stream.filter") || ua.action_type) !== ua.action_type
|
||||
) {
|
||||
return;
|
||||
}
|
||||
if (!this.get("stream.filter") && !this.inAllStream(ua)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ua.title = emojiUnescape(escapeExpression(ua.title));
|
||||
const action = UserAction.collapseStream([UserAction.create(ua)]);
|
||||
stream.set("itemsLoaded", stream.get("itemsLoaded") + 1);
|
||||
stream.get("content").insertAt(0, action[0]);
|
||||
if ((this.get("stream.filter") || ua.action_type) !== ua.action_type) {
|
||||
return;
|
||||
}
|
||||
if (!this.get("stream.filter") && !this.inAllStream(ua)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ua.title = emojiUnescape(escapeExpression(ua.title));
|
||||
const action = UserAction.collapseStream([UserAction.create(ua)]);
|
||||
stream.set("itemsLoaded", stream.get("itemsLoaded") + 1);
|
||||
stream.get("content").insertAt(0, action[0]);
|
||||
}
|
||||
);
|
||||
});
|
||||
},
|
||||
|
||||
inAllStream(ua) {
|
||||
|
@ -29,7 +29,6 @@ function reportToLogster(name, error) {
|
||||
Ember.$.ajax(getURL("/logs/report_js_error"), {
|
||||
data,
|
||||
type: "POST",
|
||||
cache: false,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -63,24 +63,18 @@ createWidgetFrom(QuickAccessPanel, "quick-access-bookmarks", {
|
||||
},
|
||||
|
||||
loadBookmarksWithReminders() {
|
||||
return ajax(`/u/${this.currentUser.username}/bookmarks.json`, {
|
||||
cache: "false",
|
||||
}).then((result) => {
|
||||
result = result.user_bookmark_list;
|
||||
return result.bookmarks;
|
||||
});
|
||||
return ajax(`/u/${this.currentUser.username}/bookmarks.json`).then(
|
||||
({ user_bookmark_list }) => user_bookmark_list.bookmarks
|
||||
);
|
||||
},
|
||||
|
||||
loadUserActivityBookmarks() {
|
||||
return ajax("/user_actions.json", {
|
||||
cache: "false",
|
||||
data: {
|
||||
username: this.currentUser.username,
|
||||
filter: UserAction.TYPES.bookmarks,
|
||||
no_results_help_key: "user_activity.no_bookmarks",
|
||||
},
|
||||
}).then(({ user_actions }) => {
|
||||
return user_actions;
|
||||
});
|
||||
}).then(({ user_actions }) => user_actions);
|
||||
},
|
||||
});
|
||||
|
@ -71,7 +71,6 @@ function loadNext(ajax) {
|
||||
category_id: categoryId,
|
||||
topic_id: topicId,
|
||||
},
|
||||
cache: true,
|
||||
})
|
||||
.then(
|
||||
(html) => {
|
||||
|
@ -11,7 +11,6 @@ export default Mixin.create({
|
||||
searchTags(url, data, callback) {
|
||||
return ajax(getURL(url), {
|
||||
quietMillis: 200,
|
||||
cache: true,
|
||||
dataType: "json",
|
||||
data,
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user