MM-26031: Migrate reaction store to plain errors (#14931)

* ReactionStore migration to return plain errors

* Fix translations

* FixImports

* Rollback fix imports

* Fix merge conflict

* add ent translation

Co-authored-by: Rodrigo Villablanca <villa061004@gmail.com>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Agniva De Sarker
2020-07-02 09:43:28 +05:30
коммит произвёл GitHub
родитель 00aeca0e5c
Коммит 71925ea224
12 изменённых файлов: 150 добавлений и 167 удалений

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

@@ -403,14 +403,13 @@ func (a *App) buildPostReplies(postId string) (*[]ReplyImportData, *model.AppErr
func (a *App) BuildPostReactions(postId string) (*[]ReactionImportData, *model.AppError) {
var reactionsOfPost []ReactionImportData
reactions, err := a.Srv().Store.Reaction().GetForPost(postId, true)
if err != nil {
return nil, err
reactions, nErr := a.Srv().Store.Reaction().GetForPost(postId, true)
if nErr != nil {
return nil, model.NewAppError("BuildPostReactions", "app.reaction.get_for_post.app_error", nil, nErr.Error(), http.StatusInternalServerError)
}
for _, reaction := range reactions {
var user *model.User
user, err = a.Srv().Store.User().Get(reaction.UserId)
user, err := a.Srv().Store.User().Get(reaction.UserId)
if err != nil {
if err.Id == store.MISSING_ACCOUNT_ERROR { // this is a valid case, the user that reacted might've been deleted by now
mlog.Info("Skipping reactions by user since the entity doesn't exist anymore", mlog.String("user_id", reaction.UserId))