[MM-28124] api4/post: return error at getFlaggedPostsForUser (#15493)

* api4/post: return error at getFlaggedPostsForUser

* api4/post_test: add additional test case for GetFlaggedPosts

* reflect review comments

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Ibrahim Serdar Acikgoz
2020-09-29 10:33:15 +03:00
коммит произвёл GitHub
родитель 7bd18264fd
Коммит c8c7fe0f4f
2 изменённых файлов: 27 добавлений и 6 удалений

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

@@ -295,6 +295,10 @@ func getFlaggedPostsForUser(c *Context, w http.ResponseWriter, r *http.Request)
} else {
posts, err = c.App.GetFlaggedPosts(c.Params.UserId, c.Params.Page, c.Params.PerPage)
}
if err != nil {
c.Err = err
return
}
pl := model.NewPostList()
channelReadPermission := make(map[string]bool)
@@ -321,12 +325,6 @@ func getFlaggedPostsForUser(c *Context, w http.ResponseWriter, r *http.Request)
}
pl.SortByCreateAt()
if err != nil {
c.Err = err
return
}
w.Write([]byte(c.App.PreparePostListForClient(pl).ToJson()))
}