Skip to content

Commit a3d5c6c

Browse files
committed
COMPATIBILITY: Update TagChooser support.
1 parent 7b37b41 commit a3d5c6c

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed
Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,43 @@
1+
import { makeArray } from "discourse/lib/helpers";
12
import TagChooser from "select-kit/components/tag-chooser";
23

34
export default TagChooser.extend({
4-
searchTags(url, data, callback) {
5+
search(query) {
6+
const selectedTags = makeArray(this.tags).filter(Boolean);
7+
8+
const data = {
9+
q: query,
10+
limit: this.siteSettings.max_tag_search_results,
11+
categoryId: this.categoryId,
12+
};
13+
14+
if (selectedTags.length || this.blockedTags.length) {
15+
data.selected_tags = selectedTags
16+
.concat(this.blockedTags)
17+
.uniq()
18+
.slice(0, 100);
19+
}
20+
21+
if (!this.everyTag) {
22+
data.filterForInput = true;
23+
}
24+
if (this.excludeSynonyms) {
25+
data.excludeSynonyms = true;
26+
}
27+
if (this.excludeHasSynonyms) {
28+
data.excludeHasSynonyms = true;
29+
}
530
if (this.tagGroups) {
631
let tagGroupsString = this.tagGroups.join(",");
732
data.filterForInput = {
833
name: "custom-wizard-tag-chooser",
934
groups: tagGroupsString,
1035
};
1136
}
12-
13-
return this._super(url, data, callback);
37+
return this.tagUtils.searchTags(
38+
"/tags/filter/search",
39+
data,
40+
this._transformJson
41+
);
1442
},
1543
});

0 commit comments

Comments
 (0)