Migrate GetAllChannels and GetAllChannelsCount from ChannelStore to r… (#14765)

* Migrate GetAllChannels and GetAllChannelsCount from ChannelStore to return plain errors

* Moving i18n translations to the correct place

Co-authored-by: Jesús Espino <jespinog@gmail.com>
Этот коммит содержится в:
Rodrigo Villablanca
2020-06-09 12:18:01 -04:00
коммит произвёл GitHub
родитель 779099d1a9
Коммит cac154e62b
10 изменённых файлов: 60 добавлений и 58 удалений

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

@@ -1563,7 +1563,12 @@ func (a *App) GetAllChannels(page, perPage int, opts model.ChannelSearchOpts) (*
NotAssociatedToGroup: opts.NotAssociatedToGroup,
IncludeDeleted: opts.IncludeDeleted,
}
return a.Srv().Store.Channel().GetAllChannels(page*perPage, perPage, storeOpts)
channels, err := a.Srv().Store.Channel().GetAllChannels(page*perPage, perPage, storeOpts)
if err != nil {
return nil, model.NewAppError("GetAllChannels", "app.channel.get_all_channels.app_error", nil, err.Error(), http.StatusInternalServerError)
}
return channels, nil
}
func (a *App) GetAllChannelsCount(opts model.ChannelSearchOpts) (int64, *model.AppError) {
@@ -1575,7 +1580,12 @@ func (a *App) GetAllChannelsCount(opts model.ChannelSearchOpts) (int64, *model.A
NotAssociatedToGroup: opts.NotAssociatedToGroup,
IncludeDeleted: opts.IncludeDeleted,
}
return a.Srv().Store.Channel().GetAllChannelsCount(storeOpts)
count, err := a.Srv().Store.Channel().GetAllChannelsCount(storeOpts)
if err != nil {
return 0, model.NewAppError("GetAllChannelsCount", "app.channel.get_all_channels_count.app_error", nil, err.Error(), http.StatusInternalServerError)
}
return count, nil
}
func (a *App) GetDeletedChannels(teamId string, offset int, limit int, userId string) (*model.ChannelList, *model.AppError) {