summaryrefslogtreecommitdiffstats
path: root/api4/context.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-02-13 10:52:50 -0500
committerCorey Hulen <corey@hulen.com>2017-02-13 10:52:50 -0500
commite4effd0c15a188eeec7a11f281e529afd6a54f80 (patch)
tree2c9b0f451366c54e163ac6f4743adf9e1cbd9a26 /api4/context.go
parent260f1111e8988b177550d2621fbf99df178ca57a (diff)
downloadchat-e4effd0c15a188eeec7a11f281e529afd6a54f80.tar.gz
chat-e4effd0c15a188eeec7a11f281e529afd6a54f80.tar.bz2
chat-e4effd0c15a188eeec7a11f281e529afd6a54f80.zip
Implement some post endpoints for APIv4 (#5353)
* Implement POST /posts endpoint for APIv4 * Implement GET /channels/{channel_id}/posts endpoint for APIv4 * Implement GET /posts/{post_id} endpoint for APIv4 * Implement GET /posts/{post_id}/thread endpoint for APIv4 * Skip team get if it's a DM channel in handlePostEvents
Diffstat (limited to 'api4/context.go')
-rw-r--r--api4/context.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/api4/context.go b/api4/context.go
index 6a22b4103..06523152f 100644
--- a/api4/context.go
+++ b/api4/context.go
@@ -375,6 +375,17 @@ func (c *Context) RequireUsername() *Context {
return c
}
+func (c *Context) RequirePostId() *Context {
+ if c.Err != nil {
+ return c
+ }
+
+ if len(c.Params.PostId) != 26 {
+ c.SetInvalidUrlParam("post_id")
+ }
+ return c
+}
+
func (c *Context) RequireEmail() *Context {
if c.Err != nil {
return c