aboutsummaryrefslogtreecommitdiff
path: root/modules/likes
diff options
context:
space:
mode:
Diffstat (limited to 'modules/likes')
-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)