summaryrefslogtreecommitdiffstats
path: root/api/post.go
diff options
context:
space:
mode:
authornickago <ngonella@calpoly.edu>2015-07-16 13:50:20 -0700
committernickago <ngonella@calpoly.edu>2015-07-16 13:50:20 -0700
commit41d2786e3e256acf22be18c96c036e84e0ae4fc9 (patch)
tree526e1fa3b1094feec7c7d885d9080be89ab00580 /api/post.go
parentd31b3e413a71607f6f9593f414892cace955fb1a (diff)
downloadchat-41d2786e3e256acf22be18c96c036e84e0ae4fc9.tar.gz
chat-41d2786e3e256acf22be18c96c036e84e0ae4fc9.tar.bz2
chat-41d2786e3e256acf22be18c96c036e84e0ae4fc9.zip
reworked logic to stem from post
Diffstat (limited to 'api/post.go')
-rw-r--r--api/post.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/api/post.go b/api/post.go
index 214429bb9..36fcafd39 100644
--- a/api/post.go
+++ b/api/post.go
@@ -620,10 +620,6 @@ func deletePost(c *Context, w http.ResponseWriter, r *http.Request) {
cchan := Srv.Store.Channel().CheckPermissionsTo(c.Session.TeamId, channelId, c.Session.UserId)
pchan := Srv.Store.Post().Get(postId)
- if !c.HasPermissionsToChannel(cchan, "deletePost") && !c.IsTeamAdmin(){
- return
- }
-
if result := <-pchan; result.Err != nil {
c.Err = result.Err
return
@@ -631,6 +627,10 @@ func deletePost(c *Context, w http.ResponseWriter, r *http.Request) {
post := result.Data.(*model.PostList).Posts[postId]
+ if !c.HasPermissionsToChannel(cchan, "deletePost") && !c.IsTeamAdmin(post.UserId){
+ return
+ }
+
if post == nil {
c.SetInvalidParam("deletePost", "postId")
return