diff options
| -rw-r--r-- | haunt/api.scm | 1 | ||||
| -rw-r--r-- | haunt/jakob/dynamic/capabilities/comments.scm | 11 |
2 files changed, 5 insertions, 7 deletions
diff --git a/haunt/api.scm b/haunt/api.scm index 810b905..1cf2b44 100644 --- a/haunt/api.scm +++ b/haunt/api.scm @@ -73,6 +73,7 @@ ('(GET "challenge" "captcha") make-captcha-challenge!) ('(GET "comments") get-comments) (('POST "comment") put-comment) + (('POST "comment" "react") put-reaction) (('GET "gallery") get-gallery) (('GET "gallery" "image") get-image) (('GET "rsvp" "event-info") get-event-info) diff --git a/haunt/jakob/dynamic/capabilities/comments.scm b/haunt/jakob/dynamic/capabilities/comments.scm index 98560b0..1da8abb 100644 --- a/haunt/jakob/dynamic/capabilities/comments.scm +++ b/haunt/jakob/dynamic/capabilities/comments.scm @@ -188,15 +188,12 @@ This is a wrapper around `get-comments-by-slug'." (define (valid-reaction? form-data) (and (assoc "id" form-data) (assoc "reaction" form-data))) - (let* ((query-string (uri-query (request-uri request))) - (form-data (if query-string - (decode-form query-string) - '()))) + (let ((form-data (decode-form body))) (unless (assoc "id" form-data) (panic "missing param `id'")) (unless (assoc "reaction" form-data) (panic "missing param `reaction'")) - (let ((id (assoc-value form-data "id")) - (reaction (assoc-value form-data "reaction")) - (reactions (comment-reactions id))) + (let* ((id (assoc-value form-data "id")) + (reaction (assoc-value form-data "reaction")) + (reactions (comment-reactions id))) (unless reactions (panic "no such comment")) (set-reactions id (add-reaction reactions reaction)) (values '((content-type . (application/json))) |