DEV: Remove unnecessary `getURL()` calls (#24591)
`ajax()` already uses it
This commit is contained in:
parent
91ec3323dd
commit
9d44d833d5
|
@ -70,6 +70,8 @@ export function ajax() {
|
|||
args = arguments[1];
|
||||
}
|
||||
|
||||
url = getURL(url);
|
||||
|
||||
let ignoreUnsent = true;
|
||||
if (args.ignoreUnsent !== undefined) {
|
||||
ignoreUnsent = args.ignoreUnsent;
|
||||
|
@ -168,7 +170,7 @@ export function ajax() {
|
|||
args.headers["Discourse-Script"] = true;
|
||||
}
|
||||
|
||||
ajaxObj = $.ajax(getURL(url), args);
|
||||
ajaxObj = $.ajax(url, args);
|
||||
}
|
||||
|
||||
let promise;
|
||||
|
|
|
@ -148,7 +148,7 @@ export default {
|
|||
data.append("topic_id", topicId);
|
||||
navigator.sendBeacon(getURL("/clicks/track"), data);
|
||||
} else {
|
||||
trackPromise = ajax(getURL("/clicks/track"), {
|
||||
trackPromise = ajax("/clicks/track", {
|
||||
type: "POST",
|
||||
data: {
|
||||
url: href,
|
||||
|
|
|
@ -2,8 +2,8 @@ import Mixin from "@ember/object/mixin";
|
|||
import AwsS3Multipart from "@uppy/aws-s3-multipart";
|
||||
import { Promise } from "rsvp";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import getUrl from "discourse-common/lib/get-url";
|
||||
import { bind } from "discourse-common/utils/decorators";
|
||||
|
||||
const RETRY_DELAYS = [0, 1000, 3000, 5000];
|
||||
const MB = 1024 * 1024;
|
||||
|
||||
|
@ -66,7 +66,7 @@ export default Mixin.create({
|
|||
data.metadata = { "sha1-checksum": file.meta.sha1_checksum };
|
||||
}
|
||||
|
||||
return ajax(getUrl(`${this.uploadRootPath}/create-multipart.json`), {
|
||||
return ajax(`${this.uploadRootPath}/create-multipart.json`, {
|
||||
type: "POST",
|
||||
data,
|
||||
// uppy is inconsistent, an error here fires the upload-error event
|
||||
|
@ -86,16 +86,13 @@ export default Mixin.create({
|
|||
if (file.preparePartsRetryAttempts === undefined) {
|
||||
file.preparePartsRetryAttempts = 0;
|
||||
}
|
||||
return ajax(
|
||||
getUrl(`${this.uploadRootPath}/batch-presign-multipart-parts.json`),
|
||||
{
|
||||
type: "POST",
|
||||
data: {
|
||||
part_numbers: partData.parts.map((part) => part.number),
|
||||
unique_identifier: file.meta.unique_identifier,
|
||||
},
|
||||
}
|
||||
)
|
||||
return ajax(`${this.uploadRootPath}/batch-presign-multipart-parts.json`, {
|
||||
type: "POST",
|
||||
data: {
|
||||
part_numbers: partData.parts.map((part) => part.number),
|
||||
unique_identifier: file.meta.unique_identifier,
|
||||
},
|
||||
})
|
||||
.then((data) => {
|
||||
if (file.preparePartsRetryAttempts) {
|
||||
delete file.preparePartsRetryAttempts;
|
||||
|
@ -145,7 +142,7 @@ export default Mixin.create({
|
|||
const parts = data.parts.map((part) => {
|
||||
return { part_number: part.PartNumber, etag: part.ETag };
|
||||
});
|
||||
return ajax(getUrl(`${this.uploadRootPath}/complete-multipart.json`), {
|
||||
return ajax(`${this.uploadRootPath}/complete-multipart.json`, {
|
||||
type: "POST",
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify({
|
||||
|
@ -180,7 +177,7 @@ export default Mixin.create({
|
|||
|
||||
file.meta.cancelled = true;
|
||||
|
||||
return ajax(getUrl(`${this.uploadRootPath}/abort-multipart.json`), {
|
||||
return ajax(`${this.uploadRootPath}/abort-multipart.json`, {
|
||||
type: "POST",
|
||||
data: {
|
||||
external_upload_identifier: uploadId,
|
||||
|
|
|
@ -397,7 +397,7 @@ export default Mixin.create(UppyS3Multipart, ExtendableUploader, {
|
|||
data.metadata = { "sha1-checksum": file.meta.sha1_checksum };
|
||||
}
|
||||
|
||||
return ajax(getUrl(`${this.uploadRootPath}/generate-presigned-put`), {
|
||||
return ajax(`${this.uploadRootPath}/generate-presigned-put`, {
|
||||
type: "POST",
|
||||
data,
|
||||
})
|
||||
|
@ -469,7 +469,7 @@ export default Mixin.create(UppyS3Multipart, ExtendableUploader, {
|
|||
},
|
||||
|
||||
_completeExternalUpload(file) {
|
||||
return ajax(getUrl(`${this.uploadRootPath}/complete-external-upload`), {
|
||||
return ajax(`${this.uploadRootPath}/complete-external-upload`, {
|
||||
type: "POST",
|
||||
data: deepMerge(
|
||||
{ unique_identifier: file.meta.uniqueUploadIdentifier },
|
||||
|
|
|
@ -3,13 +3,12 @@ import Mixin from "@ember/object/mixin";
|
|||
import { isEmpty } from "@ember/utils";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import getURL from "discourse-common/lib/get-url";
|
||||
import { makeArray } from "discourse-common/lib/helpers";
|
||||
import I18n from "discourse-i18n";
|
||||
|
||||
export default Mixin.create({
|
||||
searchTags(url, data, callback) {
|
||||
return ajax(getURL(url), { data })
|
||||
return ajax(url, { data })
|
||||
.then((json) => callback(this, json))
|
||||
.catch(popupAjaxError);
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue