FIX: hides upload link on mobile

This commit is contained in:
Joffrey JAFFEUX 2018-01-28 09:48:41 +01:00 committed by GitHub
parent 55f47491a4
commit 4c19088084
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 4 deletions

View File

@ -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',

View File

@ -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);

View File

@ -85,6 +85,7 @@
popupMenuOptions=popupMenuOptions
draftStatus=model.draftStatus
isUploading=isUploading
allowUpload=allowUpload
isCancellable=isCancellable
uploadProgress=uploadProgress
groupsMentioned="groupsMentioned"
@ -131,7 +132,9 @@
<div class="composer-bottom-right">
{{#if site.mobileView}}
<a class="mobile-file-upload {{if isUploading 'hidden'}}">{{i18n 'upload'}}</a>
{{#if allowUpload}}
<a class="mobile-file-upload {{if isUploading 'hidden'}}">{{i18n 'upload'}}</a>
{{/if}}
{{#if showPreview}}
{{d-button action='togglePreview' class='hide-preview' label='composer.hide_preview'}}