From e0ee73ef9963ab398bcc6011795ad23e8e003147 Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 31 Jan 2018 08:26:40 -0600 Subject: ABC-79: Optimize channel autocomplete query (#8163) * optimize channel autocomplete query * move to new autocomplete endpoint --- app/channel.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/channel.go') diff --git a/app/channel.go b/app/channel.go index 0054fe14b..e4bf48654 100644 --- a/app/channel.go +++ b/app/channel.go @@ -1255,6 +1255,14 @@ func (a *App) UpdateChannelLastViewedAt(channelIds []string, userId string) *mod return nil } +func (a *App) AutocompleteChannels(teamId string, term string) (*model.ChannelList, *model.AppError) { + if result := <-a.Srv.Store.Channel().AutocompleteInTeam(teamId, term); result.Err != nil { + return nil, result.Err + } else { + return result.Data.(*model.ChannelList), nil + } +} + func (a *App) SearchChannels(teamId string, term string) (*model.ChannelList, *model.AppError) { if result := <-a.Srv.Store.Channel().SearchInTeam(teamId, term); result.Err != nil { return nil, result.Err -- cgit v1.2.3-1-g7c22