diff --git a/app/assets/javascripts/discourse/components/composer-editor.js.es6 b/app/assets/javascripts/discourse/components/composer-editor.js.es6 index 09767831405..6b3ca5b4001 100644 --- a/app/assets/javascripts/discourse/components/composer-editor.js.es6 +++ b/app/assets/javascripts/discourse/components/composer-editor.js.es6 @@ -13,7 +13,6 @@ import { tinyAvatar, displayErrorForUpload, getUploadMarkdown, validateUploadedFiles, - authorizesOneOrMoreExtensions, authorizesOneOrMoreImageExtensions, formatUsername, clipboardData @@ -670,7 +669,7 @@ export default Ember.Component.extend({ unshift: true }); - if (authorizesOneOrMoreExtensions()) { + if (this.get('allowUpload')) { toolbar.addButton({ id: 'upload', group: 'insertions', diff --git a/app/assets/javascripts/discourse/controllers/composer.js.es6 b/app/assets/javascripts/discourse/controllers/composer.js.es6 index d08f59c9f4b..68b5a75bac4 100644 --- a/app/assets/javascripts/discourse/controllers/composer.js.es6 +++ b/app/assets/javascripts/discourse/controllers/composer.js.es6 @@ -5,7 +5,7 @@ import Composer from 'discourse/models/composer'; import { default as computed, observes, on } from 'ember-addons/ember-computed-decorators'; import InputValidation from 'discourse/models/input-validation'; import { getOwner } from 'discourse-common/lib/get-owner'; -import { escapeExpression } from 'discourse/lib/utilities'; +import { escapeExpression, authorizesOneOrMoreExtensions } from 'discourse/lib/utilities'; import { emojiUnescape } from 'discourse/lib/text'; import { shortDate } from 'discourse/lib/formatter'; @@ -70,6 +70,7 @@ export default Ember.Controller.extend({ scopedCategoryId: null, lastValidatedAt: null, isUploading: false, + allowUpload: false, topic: null, linkLookup: null, showPreview: true, @@ -223,6 +224,11 @@ export default Ember.Controller.extend({ return emojiUnescape(escapeExpression(topic.get('title'))); }, + @computed + allowUpload() { + return authorizesOneOrMoreExtensions(); + }, + actions: { cancelUpload() { this.set('model.uploadCancelled', true); diff --git a/app/assets/javascripts/discourse/templates/composer.hbs b/app/assets/javascripts/discourse/templates/composer.hbs index 93864a0863c..ed0b8c40285 100644 --- a/app/assets/javascripts/discourse/templates/composer.hbs +++ b/app/assets/javascripts/discourse/templates/composer.hbs @@ -85,6 +85,7 @@ popupMenuOptions=popupMenuOptions draftStatus=model.draftStatus isUploading=isUploading + allowUpload=allowUpload isCancellable=isCancellable uploadProgress=uploadProgress groupsMentioned="groupsMentioned" @@ -131,7 +132,9 @@