Trim leading and trailing spaces for search terms (#10989)
Этот коммит содержится в:
10
app/user.go
10
app/user.go
@@ -1666,6 +1666,7 @@ func (a *App) SearchUsers(props *model.UserSearch, options *model.UserSearchOpti
|
||||
}
|
||||
|
||||
func (a *App) SearchUsersInChannel(channelId string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError) {
|
||||
term = strings.TrimSpace(term)
|
||||
result := <-a.Srv.Store.User().SearchInChannel(channelId, term, options)
|
||||
if result.Err != nil {
|
||||
return nil, result.Err
|
||||
@@ -1680,6 +1681,7 @@ func (a *App) SearchUsersInChannel(channelId string, term string, options *model
|
||||
}
|
||||
|
||||
func (a *App) SearchUsersNotInChannel(teamId string, channelId string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError) {
|
||||
term = strings.TrimSpace(term)
|
||||
result := <-a.Srv.Store.User().SearchNotInChannel(teamId, channelId, term, options)
|
||||
if result.Err != nil {
|
||||
return nil, result.Err
|
||||
@@ -1696,6 +1698,8 @@ func (a *App) SearchUsersNotInChannel(teamId string, channelId string, term stri
|
||||
func (a *App) SearchUsersInTeam(teamId string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError) {
|
||||
var result store.StoreResult
|
||||
|
||||
term = strings.TrimSpace(term)
|
||||
|
||||
esInterface := a.Elasticsearch
|
||||
license := a.License()
|
||||
if esInterface != nil && *a.Config().ElasticsearchSettings.EnableAutocomplete && license != nil && *license.Features.Elasticsearch {
|
||||
@@ -1730,6 +1734,7 @@ func (a *App) SearchUsersInTeam(teamId string, term string, options *model.UserS
|
||||
}
|
||||
|
||||
func (a *App) SearchUsersNotInTeam(notInTeamId string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError) {
|
||||
term = strings.TrimSpace(term)
|
||||
result := <-a.Srv.Store.User().SearchNotInTeam(notInTeamId, term, options)
|
||||
if result.Err != nil {
|
||||
return nil, result.Err
|
||||
@@ -1744,6 +1749,7 @@ func (a *App) SearchUsersNotInTeam(notInTeamId string, term string, options *mod
|
||||
}
|
||||
|
||||
func (a *App) SearchUsersWithoutTeam(term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError) {
|
||||
term = strings.TrimSpace(term)
|
||||
result := <-a.Srv.Store.User().SearchWithoutTeam(term, options)
|
||||
if result.Err != nil {
|
||||
return nil, result.Err
|
||||
@@ -1760,6 +1766,8 @@ func (a *App) SearchUsersWithoutTeam(term string, options *model.UserSearchOptio
|
||||
func (a *App) AutocompleteUsersInChannel(teamId string, channelId string, term string, options *model.UserSearchOptions) (*model.UserAutocompleteInChannel, *model.AppError) {
|
||||
var uchan, nuchan store.StoreChannel
|
||||
|
||||
term = strings.TrimSpace(term)
|
||||
|
||||
esInterface := a.Elasticsearch
|
||||
license := a.License()
|
||||
if esInterface != nil && *a.Config().ElasticsearchSettings.EnableAutocomplete && license != nil && *license.Features.Elasticsearch {
|
||||
@@ -1820,6 +1828,8 @@ func (a *App) AutocompleteUsersInTeam(teamId string, term string, options *model
|
||||
autocomplete := &model.UserAutocompleteInTeam{}
|
||||
var result store.StoreResult
|
||||
|
||||
term = strings.TrimSpace(term)
|
||||
|
||||
esInterface := a.Elasticsearch
|
||||
license := a.License()
|
||||
if esInterface != nil && *a.Config().ElasticsearchSettings.EnableAutocomplete && license != nil && *license.Features.Elasticsearch {
|
||||
|
||||
Ссылка в новой задаче
Block a user