[MM-16568] Migrate "User.SearchInChannel" to Sync by default (#11417)
* implemented migration to sync * updated user.go to use explicit async approach
Этот коммит содержится в:
коммит произвёл
Jesús Espino
родитель
f8ba59ca9e
Коммит
1aa1363e63
18
app/user.go
18
app/user.go
@@ -1674,12 +1674,10 @@ 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
|
||||
users, err := a.Srv.Store.User().SearchInChannel(channelId, term, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
users := result.Data.([]*model.User)
|
||||
|
||||
for _, user := range users {
|
||||
a.SanitizeProfile(user, options.IsAdmin)
|
||||
}
|
||||
@@ -1847,13 +1845,21 @@ func (a *App) AutocompleteUsersInChannel(teamId string, channelId string, term s
|
||||
|
||||
if !a.IsESAutocompletionEnabled() || err != nil {
|
||||
autocomplete = &model.UserAutocompleteInChannel{}
|
||||
uchan := a.Srv.Store.User().SearchInChannel(channelId, term, options)
|
||||
|
||||
uchan := make(chan store.StoreResult, 1)
|
||||
go func() {
|
||||
users, err := a.Srv.Store.User().SearchInChannel(channelId, term, options)
|
||||
uchan <- store.StoreResult{Data: users, Err: err}
|
||||
close(uchan)
|
||||
}()
|
||||
|
||||
nuchan := a.Srv.Store.User().SearchNotInChannel(teamId, channelId, term, options)
|
||||
|
||||
result := <-uchan
|
||||
if result.Err != nil {
|
||||
return nil, result.Err
|
||||
}
|
||||
|
||||
users := result.Data.([]*model.User)
|
||||
|
||||
for _, user := range users {
|
||||
|
||||
Ссылка в новой задаче
Block a user