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, displayErrorForUpload,
getUploadMarkdown, getUploadMarkdown,
validateUploadedFiles, validateUploadedFiles,
authorizesOneOrMoreExtensions,
authorizesOneOrMoreImageExtensions, authorizesOneOrMoreImageExtensions,
formatUsername, formatUsername,
clipboardData clipboardData
@ -670,7 +669,7 @@ export default Ember.Component.extend({
unshift: true unshift: true
}); });
if (authorizesOneOrMoreExtensions()) { if (this.get('allowUpload')) {
toolbar.addButton({ toolbar.addButton({
id: 'upload', id: 'upload',
group: 'insertions', 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 { default as computed, observes, on } from 'ember-addons/ember-computed-decorators';
import InputValidation from 'discourse/models/input-validation'; import InputValidation from 'discourse/models/input-validation';
import { getOwner } from 'discourse-common/lib/get-owner'; 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 { emojiUnescape } from 'discourse/lib/text';
import { shortDate } from 'discourse/lib/formatter'; import { shortDate } from 'discourse/lib/formatter';
@ -70,6 +70,7 @@ export default Ember.Controller.extend({
scopedCategoryId: null, scopedCategoryId: null,
lastValidatedAt: null, lastValidatedAt: null,
isUploading: false, isUploading: false,
allowUpload: false,
topic: null, topic: null,
linkLookup: null, linkLookup: null,
showPreview: true, showPreview: true,
@ -223,6 +224,11 @@ export default Ember.Controller.extend({
return emojiUnescape(escapeExpression(topic.get('title'))); return emojiUnescape(escapeExpression(topic.get('title')));
}, },
@computed
allowUpload() {
return authorizesOneOrMoreExtensions();
},
actions: { actions: {
cancelUpload() { cancelUpload() {
this.set('model.uploadCancelled', true); this.set('model.uploadCancelled', true);

View File

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