summaryrefslogtreecommitdiffstats
path: root/app/post.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-03-24 16:46:11 -0400
committerCorey Hulen <corey@hulen.com>2017-03-24 13:46:11 -0700
commit69fb47b88bc8d97c4797fa72e60416f8fb658e20 (patch)
tree263641b645eb1c1403d238c91c470de49a5a516d /app/post.go
parent28a78d76074749a3b7f1ef2a56617b0a1c7fd623 (diff)
downloadchat-69fb47b88bc8d97c4797fa72e60416f8fb658e20.tar.gz
chat-69fb47b88bc8d97c4797fa72e60416f8fb658e20.tar.bz2
chat-69fb47b88bc8d97c4797fa72e60416f8fb658e20.zip
Add query parameters to get posts v4 endpoint (#5858)
* Add since query paremeter to get posts v4 endpoint * Add query paremeters for before/after to get posts v4 endpoint
Diffstat (limited to 'app/post.go')
-rw-r--r--app/post.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/post.go b/app/post.go
index f969b6c6b..bfd0fccc5 100644
--- a/app/post.go
+++ b/app/post.go
@@ -395,6 +395,22 @@ func GetPermalinkPost(postId string, userId string, siteURL string) (*model.Post
}
}
+func GetPostsBeforePost(channelId, postId string, page, perPage int) (*model.PostList, *model.AppError) {
+ if result := <-Srv.Store.Post().GetPostsBefore(channelId, postId, perPage, page*perPage); result.Err != nil {
+ return nil, result.Err
+ } else {
+ return result.Data.(*model.PostList), nil
+ }
+}
+
+func GetPostsAfterPost(channelId, postId string, page, perPage int) (*model.PostList, *model.AppError) {
+ if result := <-Srv.Store.Post().GetPostsAfter(channelId, postId, perPage, page*perPage); result.Err != nil {
+ return nil, result.Err
+ } else {
+ return result.Data.(*model.PostList), nil
+ }
+}
+
func GetPostsAroundPost(postId, channelId string, offset, limit int, before bool) (*model.PostList, *model.AppError) {
var pchan store.StoreChannel
if before {