diff options
author | jan <jan@ruken.pw> | 2016-11-14 20:34:57 (UTC) |
---|---|---|
committer | rtz12 <koenig@fagott.pw> | 2016-11-15 17:52:28 (UTC) |
commit | 7f5dbb410bcfbd4d926b99f61e15fd9b0ff339ee (patch) | |
tree | 54295a7b59e46ee412cc6066e86d36781940cac9 /modules/likes | |
parent | 77534b0c8fb59b7a670d21e9c98832fa84e11f70 (diff) |
jetzt auch im backend nicht mehr
Diffstat (limited to 'modules/likes')
-rw-r--r-- | modules/likes/likes.go | 8 |
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) |