FIX: displays correct upload icon when only images are allowed
This commit is contained in:
parent
c18b86d9b2
commit
4b604b1e68
|
@ -816,11 +816,11 @@ export default Ember.Component.extend({
|
|||
unshift: true
|
||||
});
|
||||
|
||||
if (this.get("allowUpload")) {
|
||||
if (this.get("allowUpload") && this.get("uploadIcon")) {
|
||||
toolbar.addButton({
|
||||
id: "upload",
|
||||
group: "insertions",
|
||||
icon: "upload",
|
||||
icon: this.get("uploadIcon"),
|
||||
title: "upload",
|
||||
sendAction: "showUploadModal"
|
||||
});
|
||||
|
|
|
@ -11,6 +11,7 @@ import InputValidation from "discourse/models/input-validation";
|
|||
import { getOwner } from "discourse-common/lib/get-owner";
|
||||
import {
|
||||
escapeExpression,
|
||||
uploadIcon,
|
||||
authorizesOneOrMoreExtensions
|
||||
} from "discourse/lib/utilities";
|
||||
import { emojiUnescape } from "discourse/lib/text";
|
||||
|
@ -88,6 +89,7 @@ export default Ember.Controller.extend({
|
|||
lastValidatedAt: null,
|
||||
isUploading: false,
|
||||
allowUpload: false,
|
||||
uploadIcon: "upload",
|
||||
topic: null,
|
||||
linkLookup: null,
|
||||
showPreview: true,
|
||||
|
@ -286,6 +288,8 @@ export default Ember.Controller.extend({
|
|||
return authorizesOneOrMoreExtensions();
|
||||
},
|
||||
|
||||
@computed() uploadIcon: () => uploadIcon(),
|
||||
|
||||
actions: {
|
||||
cancelUpload() {
|
||||
this.set("model.uploadCancelled", true);
|
||||
|
|
|
@ -6,7 +6,8 @@ import {
|
|||
import {
|
||||
allowsAttachments,
|
||||
authorizesAllExtensions,
|
||||
authorizedExtensions
|
||||
authorizedExtensions,
|
||||
uploadIcon
|
||||
} from "discourse/lib/utilities";
|
||||
|
||||
function uploadTranslate(key) {
|
||||
|
@ -24,7 +25,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
remote: Ember.computed.equal("selection", "remote"),
|
||||
selection: "local",
|
||||
|
||||
@computed() uploadIcon: () => (allowsAttachments() ? "upload" : "picture-o"),
|
||||
@computed() uploadIcon: () => uploadIcon(),
|
||||
|
||||
@computed() title: () => uploadTranslate("title"),
|
||||
|
||||
|
|
|
@ -420,6 +420,10 @@ export function allowsAttachments() {
|
|||
);
|
||||
}
|
||||
|
||||
export function uploadIcon() {
|
||||
return allowsAttachments() ? "upload" : "picture-o";
|
||||
}
|
||||
|
||||
export function uploadLocation(url) {
|
||||
if (Discourse.CDN) {
|
||||
url = Discourse.getURLWithCDN(url);
|
||||
|
|
|
@ -84,6 +84,7 @@
|
|||
draftStatus=model.draftStatus
|
||||
isUploading=isUploading
|
||||
allowUpload=allowUpload
|
||||
uploadIcon=uploadIcon
|
||||
isCancellable=isCancellable
|
||||
uploadProgress=uploadProgress
|
||||
groupsMentioned="groupsMentioned"
|
||||
|
|
Loading…
Reference in New Issue