summaryrefslogtreecommitdiff
path: root/dynamic/capabilities/comments.scm
diff options
context:
space:
mode:
Diffstat (limited to 'dynamic/capabilities/comments.scm')
-rw-r--r--dynamic/capabilities/comments.scm13
1 files changed, 8 insertions, 5 deletions
diff --git a/dynamic/capabilities/comments.scm b/dynamic/capabilities/comments.scm
index fb965c9..945e382 100644
--- a/dynamic/capabilities/comments.scm
+++ b/dynamic/capabilities/comments.scm
@@ -35,16 +35,19 @@
This interface exists for dynamically generating the comment view from Haunt."
(define (format-comment comment)
(match comment
- ((id name subject email comment reactions)
+ ((id name subject email comment url reactions)
`((id . ,id)
(name . ,name)
(subject . ,subject)
(email . ,email)
(comment . ,comment)
- (reactions . ,(with-input-from-string reactions read))))))
- (let* ((query "SELECT id, name, subject, email, comment, reactions
+ (url . ,url)
+ (reactions . ,(if reactions
+ (with-input-from-string reactions read)
+ '()))))))
+ (let* ((query "SELECT id, name, subject, email, comment, url, reactions
FROM comments WHERE slug = $1 and approved IS NOT NULL")
- (result (exec-query conn query (list (car slug)))))
+ (result (exec-query conn query (list slug))))
(map format-comment result)))
(define (get-comments request body)
@@ -60,7 +63,7 @@ This is a wrapper around `get-comments-by-slug'."
(values '((content-type . (application/json)))
(scm->json-string
(list->vector
- (get-comments-by-slug slug))))
+ (get-comments-by-slug (car slug)))))
(values (build-response #:code 400)
(scm->json-string
`((success . #f)