Migrate GetDeleted method from ChannelStore to return error interface (#14710)

* Migrate GetDeleted method from ChannelStore to return error interface

* Moving i18n translations to the correct place

Co-authored-by: Jesús Espino <jespinog@gmail.com>
Этот коммит содержится в:
Rodrigo Villablanca
2020-06-11 00:07:37 -04:00
коммит произвёл GitHub
родитель f2253df8a1
Коммит 9b0ae49b55
8 изменённых файлов: 40 добавлений и 31 удалений

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

@@ -1589,7 +1589,18 @@ func (a *App) GetAllChannelsCount(opts model.ChannelSearchOpts) (int64, *model.A
}
func (a *App) GetDeletedChannels(teamId string, offset int, limit int, userId string) (*model.ChannelList, *model.AppError) {
return a.Srv().Store.Channel().GetDeleted(teamId, offset, limit, userId)
list, err := a.Srv().Store.Channel().GetDeleted(teamId, offset, limit, userId)
if err != nil {
var nfErr *store.ErrNotFound
switch {
case errors.As(err, &nfErr):
return nil, model.NewAppError("GetDeletedChannels", "app.channel.get_deleted.missing.app_error", nil, err.Error(), http.StatusNotFound)
default:
return nil, model.NewAppError("GetDeletedChannels", "app.channel.get_deleted.existing.app_error", nil, err.Error(), http.StatusInternalServerError)
}
}
return list, nil
}
func (a *App) GetChannelsUserNotIn(teamId string, userId string, offset int, limit int) (*model.ChannelList, *model.AppError) {