mirror of
https://github.com/discourse/discourse.git
synced 2025-01-31 03:09:29 +08:00
FIX: share selected tags between tag-chooser in preferences
This commit is contained in:
parent
8027096c09
commit
fd7308e7f6
|
@ -10,7 +10,7 @@ export default Ember.Controller.extend(PreferencesTabController, {
|
||||||
'watching_first_post_tags'
|
'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) {
|
selectedTags(watched, watchedFirst, tracked, muted) {
|
||||||
return [].concat(watched, watchedFirst, tracked, muted).filter(t => t);
|
return [].concat(watched, watchedFirst, tracked, muted).filter(t => t);
|
||||||
},
|
},
|
||||||
|
|
|
@ -11,6 +11,7 @@ export default MultiSelectComponent.extend(Tags, {
|
||||||
filterable: true,
|
filterable: true,
|
||||||
filterPlaceholder: "tagging.choose_for_topic",
|
filterPlaceholder: "tagging.choose_for_topic",
|
||||||
limit: null,
|
limit: null,
|
||||||
|
blacklist: null,
|
||||||
attributeBindings: ["categoryId"],
|
attributeBindings: ["categoryId"],
|
||||||
allowAny: Ember.computed.alias("allowCreate"),
|
allowAny: Ember.computed.alias("allowCreate"),
|
||||||
|
|
||||||
|
@ -21,6 +22,10 @@ export default MultiSelectComponent.extend(Tags, {
|
||||||
this.set("allowCreate", this.site.get("can_create_tag"));
|
this.set("allowCreate", this.site.get("can_create_tag"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.get("blacklist")) {
|
||||||
|
this.set("blacklist", []);
|
||||||
|
}
|
||||||
|
|
||||||
this.set("termMatchesForbidden", false);
|
this.set("termMatchesForbidden", false);
|
||||||
|
|
||||||
this.set("templateForRow", (rowComponent) => {
|
this.set("templateForRow", (rowComponent) => {
|
||||||
|
@ -57,9 +62,7 @@ export default MultiSelectComponent.extend(Tags, {
|
||||||
},
|
},
|
||||||
|
|
||||||
onExpand() {
|
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() {
|
onDeselect() {
|
||||||
|
@ -79,7 +82,12 @@ export default MultiSelectComponent.extend(Tags, {
|
||||||
limit: this.get("siteSettings.max_tag_search_results"),
|
limit: this.get("siteSettings.max_tag_search_results"),
|
||||||
categoryId: this.get("categoryId")
|
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;
|
if (!this.get("everyTag")) data.filterForInput = true;
|
||||||
|
|
||||||
this.searchTags("/tags/filter/search", data, this._transformJson);
|
this.searchTags("/tags/filter/search", data, this._transformJson);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user