diff --git a/app/assets/javascripts/discourse/app/components/composer-editor.js b/app/assets/javascripts/discourse/app/components/composer-editor.js index 46dbaddbe81..a8d784969aa 100644 --- a/app/assets/javascripts/discourse/app/components/composer-editor.js +++ b/app/assets/javascripts/discourse/app/components/composer-editor.js @@ -766,7 +766,7 @@ export default Component.extend({ this._xhr = null; if (!userCancelled) { - displayErrorForUpload(data); + displayErrorForUpload(data, this.siteSettings); } }); diff --git a/app/assets/javascripts/discourse/app/lib/uploads.js b/app/assets/javascripts/discourse/app/lib/uploads.js index 22776a4e234..83bc9ec5581 100644 --- a/app/assets/javascripts/discourse/app/lib/uploads.js +++ b/app/assets/javascripts/discourse/app/lib/uploads.js @@ -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; diff --git a/app/assets/javascripts/discourse/app/mixins/upload.js b/app/assets/javascripts/discourse/app/mixins/upload.js index 1c6b026ab70..968313a5f0f 100644 --- a/app/assets/javascripts/discourse/app/mixins/upload.js +++ b/app/assets/javascripts/discourse/app/mixins/upload.js @@ -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(); });