Ignore "@" sign at the beginning of user searches (#9780)
This trims the "@" symbol from the begging of the search term before executing the query.
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
7a758eae72
Коммит
fa0aecce1e
@@ -1166,7 +1166,7 @@ func generateSearchQuery(searchQuery string, terms []string, fields []string, pa
|
||||
}
|
||||
}
|
||||
searchTerms = append(searchTerms, fmt.Sprintf("(%s)", strings.Join(searchFields, " OR ")))
|
||||
parameters[fmt.Sprintf("Term%d", i)] = fmt.Sprintf("%s%%", term)
|
||||
parameters[fmt.Sprintf("Term%d", i)] = fmt.Sprintf("%s%%", strings.TrimLeft(term, "@"))
|
||||
}
|
||||
|
||||
searchClause := strings.Join(searchTerms, " AND ")
|
||||
|
||||
@@ -1658,6 +1658,16 @@ func testUserStoreSearch(t *testing.T, ss store.Store) {
|
||||
},
|
||||
[]*model.User{u1},
|
||||
},
|
||||
{
|
||||
"leading @ should be ignored",
|
||||
tid,
|
||||
"@jimb",
|
||||
&model.UserSearchOptions{
|
||||
AllowFullNames: true,
|
||||
Limit: model.USER_SEARCH_DEFAULT_LIMIT,
|
||||
},
|
||||
[]*model.User{u1},
|
||||
},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
|
||||
Ссылка в новой задаче
Block a user