From 2850279c45d522bd0241eb683d667b5737294605 Mon Sep 17 00:00:00 2001 From: Vikhyat Korrapati Date: Fri, 6 Dec 2013 10:29:15 +0530 Subject: [PATCH] Don't show the upload option if max_attachment_size_kb is 0. --- .../controllers/upload_selector_controller.js | 8 +++++-- .../modal/upload_selector.js.handlebars | 22 ++++++++++--------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/app/assets/javascripts/discourse/controllers/upload_selector_controller.js b/app/assets/javascripts/discourse/controllers/upload_selector_controller.js index 91739024cf0..85237fdacef 100644 --- a/app/assets/javascripts/discourse/controllers/upload_selector_controller.js +++ b/app/assets/javascripts/discourse/controllers/upload_selector_controller.js @@ -8,8 +8,12 @@ @module Discourse **/ Discourse.UploadSelectorController = Discourse.Controller.extend(Discourse.ModalFunctionality, { - local: true, - remote: Em.computed.not("local"), + local: Em.computed.not("remote"), + remote: Em.computed.not("allowLocal"), + + allowLocal: function() { + return Discourse.SiteSettings.max_attachment_size_kb > 0; + }.property(), actions: { useLocal: function() { this.set("local", true); }, diff --git a/app/assets/javascripts/discourse/templates/modal/upload_selector.js.handlebars b/app/assets/javascripts/discourse/templates/modal/upload_selector.js.handlebars index 826bd31f1b1..c1f4da21ada 100644 --- a/app/assets/javascripts/discourse/templates/modal/upload_selector.js.handlebars +++ b/app/assets/javascripts/discourse/templates/modal/upload_selector.js.handlebars @@ -1,14 +1,16 @@