REFACTOR: Remove `Discourse.SiteSettings` from upload.js
This commit is contained in:
parent
6fb8a92ca2
commit
5077cf52fd
|
@ -766,7 +766,7 @@ export default Component.extend({
|
|||
this._xhr = null;
|
||||
|
||||
if (!userCancelled) {
|
||||
displayErrorForUpload(data);
|
||||
displayErrorForUpload(data, this.siteSettings);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -266,7 +266,7 @@ export function getUploadMarkdown(upload) {
|
|||
}
|
||||
}
|
||||
|
||||
export function displayErrorForUpload(data) {
|
||||
export function displayErrorForUpload(data, siteSettings) {
|
||||
if (data.jqXHR) {
|
||||
switch (data.jqXHR.status) {
|
||||
// cancelled by the user
|
||||
|
@ -276,7 +276,7 @@ export function displayErrorForUpload(data) {
|
|||
// entity too large, usually returned from the web server
|
||||
case 413:
|
||||
const type = uploadTypeFromFileName(data.files[0].name);
|
||||
const max_size_kb = Discourse.SiteSettings[`max_${type}_size_kb`];
|
||||
const max_size_kb = siteSettings[`max_${type}_size_kb`];
|
||||
bootbox.alert(I18n.t("post.errors.file_too_large", { max_size_kb }));
|
||||
return;
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ export default Mixin.create({
|
|||
|
||||
$upload.on("fileuploadfail", (e, data) => {
|
||||
if (!data || data.errorThrown !== "abort") {
|
||||
displayErrorForUpload(data);
|
||||
displayErrorForUpload(data, this.siteSettings);
|
||||
}
|
||||
reset();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue