mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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;
|
this._xhr = null;
|
||||||
|
|
||||||
if (!userCancelled) {
|
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) {
|
if (data.jqXHR) {
|
||||||
switch (data.jqXHR.status) {
|
switch (data.jqXHR.status) {
|
||||||
// cancelled by the user
|
// cancelled by the user
|
||||||
@ -276,7 +276,7 @@ export function displayErrorForUpload(data) {
|
|||||||
// entity too large, usually returned from the web server
|
// entity too large, usually returned from the web server
|
||||||
case 413:
|
case 413:
|
||||||
const type = uploadTypeFromFileName(data.files[0].name);
|
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 }));
|
bootbox.alert(I18n.t("post.errors.file_too_large", { max_size_kb }));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ export default Mixin.create({
|
|||||||
|
|
||||||
$upload.on("fileuploadfail", (e, data) => {
|
$upload.on("fileuploadfail", (e, data) => {
|
||||||
if (!data || data.errorThrown !== "abort") {
|
if (!data || data.errorThrown !== "abort") {
|
||||||
displayErrorForUpload(data);
|
displayErrorForUpload(data, this.siteSettings);
|
||||||
}
|
}
|
||||||
reset();
|
reset();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user