summaryrefslogtreecommitdiffstats
path: root/api4
diff options
context:
space:
mode:
authorSaturnino Abril <saturnino.abril@gmail.com>2017-06-27 04:05:50 +0800
committerGeorge Goldberg <george@gberg.me>2017-06-26 21:05:50 +0100
commitf2abb9d8eb4b35369d286749ede37916a8979e07 (patch)
treeeab631042f86bdd4e21370e826d47a1f9d668168 /api4
parentffaab0bf22952f4e4c43fab62955eb0cdc13612b (diff)
downloadchat-f2abb9d8eb4b35369d286749ede37916a8979e07.tar.gz
chat-f2abb9d8eb4b35369d286749ede37916a8979e07.tar.bz2
chat-f2abb9d8eb4b35369d286749ede37916a8979e07.zip
fix permission app error with updatePost (#6749)
Diffstat (limited to 'api4')
-rw-r--r--api4/post.go4
-rw-r--r--api4/post_test.go2
2 files changed, 6 insertions, 0 deletions
diff --git a/api4/post.go b/api4/post.go
index 7bfe5ad64..65a508df7 100644
--- a/api4/post.go
+++ b/api4/post.go
@@ -302,6 +302,10 @@ func searchPosts(c *Context, w http.ResponseWriter, r *http.Request) {
func updatePost(c *Context, w http.ResponseWriter, r *http.Request) {
c.RequirePostId()
+ if c.Err != nil {
+ return
+ }
+
post := model.PostFromJson(r.Body)
if post == nil {
diff --git a/api4/post_test.go b/api4/post_test.go
index abfd83989..a2c0b065b 100644
--- a/api4/post_test.go
+++ b/api4/post_test.go
@@ -137,6 +137,8 @@ func TestUpdatePost(t *testing.T) {
msg := "zz" + model.NewId() + " update post"
rpost.Message = msg
+ rpost.UserId = ""
+
rupost, resp := Client.UpdatePost(rpost.Id, rpost)
CheckNoError(t, resp)