Migrates Channel.GetChannels to sync by default (#11204)

* Migrates Channel.GetChannels to sync by default

* Some suggestions

* resolved undefined var
Этот коммит содержится в:
Rodrigo Villablanca Vásquez
2019-06-20 03:31:40 -04:00
коммит произвёл Jesús Espino
родитель 3c13b0e4e7
Коммит 327a1c92e8
7 изменённых файлов: 47 добавлений и 51 удалений

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

@@ -1226,11 +1226,7 @@ func (a *App) GetChannelByNameForTeamName(channelName, teamName string, includeD
}
func (a *App) GetChannelsForUser(teamId string, userId string, includeDeleted bool) (*model.ChannelList, *model.AppError) {
result := <-a.Srv.Store.Channel().GetChannels(teamId, userId, includeDeleted)
if result.Err != nil {
return nil, result.Err
}
return result.Data.(*model.ChannelList), nil
return a.Srv.Store.Channel().GetChannels(teamId, userId, includeDeleted)
}
func (a *App) GetAllChannels(page, perPage int, opts model.ChannelSearchOpts) (*model.ChannelListWithTeamData, *model.AppError) {

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

@@ -823,14 +823,12 @@ func (a *App) LeaveTeam(team *model.Team, user *model.User, requestorId string)
var channelList *model.ChannelList
if result := <-a.Srv.Store.Channel().GetChannels(team.Id, user.Id, true); result.Err != nil {
if result.Err.Id == "store.sql_channel.get_channels.not_found.app_error" {
if channelList, err = a.Srv.Store.Channel().GetChannels(team.Id, user.Id, true); err != nil {
if err.Id == "store.sql_channel.get_channels.not_found.app_error" {
channelList = &model.ChannelList{}
} else {
return result.Err
return err
}
} else {
channelList = result.Data.(*model.ChannelList)
}
for _, channel := range *channelList {