aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjan <jan@ruken.pw>2016-11-14 20:34:57 (UTC)
committerrtz12 <koenig@fagott.pw>2016-11-15 17:52:28 (UTC)
commit7f5dbb410bcfbd4d926b99f61e15fd9b0ff339ee (patch)
tree54295a7b59e46ee412cc6066e86d36781940cac9
parent77534b0c8fb59b7a670d21e9c98832fa84e11f70 (diff)
jetzt auch im backend nicht mehr
-rw-r--r--modules/likes/likes.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/likes/likes.go b/modules/likes/likes.go
index 02cf9d5..80f632b 100644
--- a/modules/likes/likes.go
+++ b/modules/likes/likes.go
@@ -142,6 +142,14 @@ func (m *Module) addLike(w http.ResponseWriter, r *http.Request, p httprouter.Pa
142 return 142 return
143 } 143 }
144 144
145 lists := m.lists.GetUserLists(user, false)
146 for _, list := range lists {
147 if list.Owner.ID == user.ID {
148 http.Error(w, "403", http.StatusForbidden)
149 return
150 }
151 }
152
145 _, err = m.g.DB.Exec(`INSERT INTO grilist.likes(content, "user", type) SELECT $1, $2, $3 WHERE NOT EXISTS (SELECT * FROM grilist.likes WHERE content = $1 AND "user" = $2 AND type = $3)`, contentId, userId, contentType) 153 _, err = m.g.DB.Exec(`INSERT INTO grilist.likes(content, "user", type) SELECT $1, $2, $3 WHERE NOT EXISTS (SELECT * FROM grilist.likes WHERE content = $1 AND "user" = $2 AND type = $3)`, contentId, userId, contentType)
146 if err != nil { 154 if err != nil {
147 http.Error(w, "pq error", http.StatusInternalServerError) 155 http.Error(w, "pq error", http.StatusInternalServerError)