From b2cacc5b0edc15c452bf8abe4fd42cc6423417b2 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Tue, 26 Mar 2019 16:45:38 +0100 Subject: [PATCH] FIX: check can_create_tags on mini-tag-chooser as tag-chooser (#7260) --- .../select-kit/components/mini-tag-chooser.js.es6 | 7 ++++++- .../javascripts/select-kit/components/tag-chooser.js.es6 | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/select-kit/components/mini-tag-chooser.js.es6 b/app/assets/javascripts/select-kit/components/mini-tag-chooser.js.es6 index 662d6c43849..eb26c062d67 100644 --- a/app/assets/javascripts/select-kit/components/mini-tag-chooser.js.es6 +++ b/app/assets/javascripts/select-kit/components/mini-tag-chooser.js.es6 @@ -16,7 +16,8 @@ export default ComboBox.extend(TagsMixin, { verticalOffset: 3, filterable: true, noTags: Ember.computed.empty("selection"), - allowAny: true, + allowCreate: null, + allowAny: Ember.computed.alias("allowCreate"), caretUpIcon: Ember.computed.alias("caretIcon"), caretDownIcon: Ember.computed.alias("caretIcon"), isAsync: true, @@ -28,6 +29,10 @@ export default ComboBox.extend(TagsMixin, { this.set("termMatchesForbidden", false); this.selectionSelector = ".selected-tag"; + if (this.get("allowCreate") !== false) { + this.set("allowCreate", this.site.get("can_create_tag")); + } + this.set("templateForRow", rowComponent => { const tag = rowComponent.get("computedContent"); return renderTag(get(tag, "value"), { diff --git a/app/assets/javascripts/select-kit/components/tag-chooser.js.es6 b/app/assets/javascripts/select-kit/components/tag-chooser.js.es6 index 46ece3ca5a7..2d9fe9ae88a 100644 --- a/app/assets/javascripts/select-kit/components/tag-chooser.js.es6 +++ b/app/assets/javascripts/select-kit/components/tag-chooser.js.es6 @@ -13,6 +13,7 @@ export default MultiSelectComponent.extend(TagsMixin, { limit: null, blacklist: null, attributeBindings: ["categoryId"], + allowCreate: null, allowAny: Ember.computed.alias("allowCreate"), init() {