[MM-16568] Migrate "User.SearchInChannel" to Sync by default (#11417)

* implemented migration to sync

* updated user.go to use explicit async approach
Этот коммит содержится в:
Alex Sahin
2019-07-01 11:44:09 +01:00
коммит произвёл Jesús Espino
родитель f8ba59ca9e
Коммит 1aa1363e63
5 изменённых файлов: 40 добавлений и 23 удалений

Просмотреть файл

@@ -1303,15 +1303,17 @@ func (us SqlUserStore) SearchNotInChannel(teamId string, channelId string, term
})
}
func (us SqlUserStore) SearchInChannel(channelId string, term string, options *model.UserSearchOptions) store.StoreChannel {
return store.Do(func(result *store.StoreResult) {
query := us.usersQuery.
Join("ChannelMembers cm ON ( cm.UserId = u.Id AND cm.ChannelId = ? )", channelId).
OrderBy("Username ASC").
Limit(uint64(options.Limit))
func (us SqlUserStore) SearchInChannel(channelId string, term string, options *model.UserSearchOptions) ([]*model.User, *model.AppError) {
query := us.usersQuery.
Join("ChannelMembers cm ON ( cm.UserId = u.Id AND cm.ChannelId = ? )", channelId).
OrderBy("Username ASC").
Limit(uint64(options.Limit))
*result = us.performSearch(query, term, options)
})
result := us.performSearch(query, term, options)
if result.Err != nil {
return nil, result.Err
}
return result.Data.([]*model.User), nil
}
var escapeLikeSearchChar = []string{