File tree Expand file tree Collapse file tree 1 file changed +31
-3
lines changed
assets/javascripts/discourse/components Expand file tree Collapse file tree 1 file changed +31
-3
lines changed Original file line number Diff line number Diff line change
1
+ import { makeArray } from "discourse/lib/helpers" ;
1
2
import TagChooser from "select-kit/components/tag-chooser" ;
2
3
3
4
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
+ }
5
30
if ( this . tagGroups ) {
6
31
let tagGroupsString = this . tagGroups . join ( "," ) ;
7
32
data . filterForInput = {
8
33
name : "custom-wizard-tag-chooser" ,
9
34
groups : tagGroupsString ,
10
35
} ;
11
36
}
12
-
13
- return this . _super ( url , data , callback ) ;
37
+ return this . tagUtils . searchTags (
38
+ "/tags/filter/search" ,
39
+ data ,
40
+ this . _transformJson
41
+ ) ;
14
42
} ,
15
43
} ) ;
You can’t perform that action at this time.
0 commit comments