diff --git a/app/assets/javascripts/discourse/controllers/preferences/tags.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/tags.js.es6 index b7e0ab97cf4..39608df5b45 100644 --- a/app/assets/javascripts/discourse/controllers/preferences/tags.js.es6 +++ b/app/assets/javascripts/discourse/controllers/preferences/tags.js.es6 @@ -10,7 +10,7 @@ export default Ember.Controller.extend(PreferencesTabController, { 'watching_first_post_tags' ], - @computed("model.watched_tags", "model.watching_first_post_tags", "model.tracked_tags", "model.muted_tags") + @computed("model.watched_tags.[]", "model.watching_first_post_tags.[]", "model.tracked_tags.[]", "model.muted_tags.[]") selectedTags(watched, watchedFirst, tracked, muted) { return [].concat(watched, watchedFirst, tracked, muted).filter(t => t); }, 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 0f4b1f5e860..6499e428116 100644 --- a/app/assets/javascripts/select-kit/components/tag-chooser.js.es6 +++ b/app/assets/javascripts/select-kit/components/tag-chooser.js.es6 @@ -11,6 +11,7 @@ export default MultiSelectComponent.extend(Tags, { filterable: true, filterPlaceholder: "tagging.choose_for_topic", limit: null, + blacklist: null, attributeBindings: ["categoryId"], allowAny: Ember.computed.alias("allowCreate"), @@ -21,6 +22,10 @@ export default MultiSelectComponent.extend(Tags, { this.set("allowCreate", this.site.get("can_create_tag")); } + if (!this.get("blacklist")) { + this.set("blacklist", []); + } + this.set("termMatchesForbidden", false); this.set("templateForRow", (rowComponent) => { @@ -57,9 +62,7 @@ export default MultiSelectComponent.extend(Tags, { }, onExpand() { - if (isEmpty(this.get("collectionComputedContent"))) { - this.set("searchDebounce", run.debounce(this, this.prepareSearch, this.get("filter"), 200)); - } + this.set("searchDebounce", run.debounce(this, this.prepareSearch, this.get("filter"), 200)); }, onDeselect() { @@ -79,7 +82,12 @@ export default MultiSelectComponent.extend(Tags, { limit: this.get("siteSettings.max_tag_search_results"), categoryId: this.get("categoryId") }; - if (selectedTags) data.selected_tags = selectedTags.slice(0, 100); + + if (selectedTags.length || this.get("blacklist").length) { + data.selected_tags = _.uniq(selectedTags.concat(this.get("blacklist"))) + .slice(0, 100); + } + if (!this.get("everyTag")) data.filterForInput = true; this.searchTags("/tags/filter/search", data, this._transformJson);