diff options
Diffstat (limited to 'jakob/dynamic/capabilities')
| -rw-r--r-- | jakob/dynamic/capabilities/comments.scm | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/jakob/dynamic/capabilities/comments.scm b/jakob/dynamic/capabilities/comments.scm index d2e34dc..fe355e2 100644 --- a/jakob/dynamic/capabilities/comments.scm +++ b/jakob/dynamic/capabilities/comments.scm @@ -15,6 +15,7 @@ ;;; <http://www.gnu.org/licenses/>. (define-module (jakob dynamic capabilities comments) + #:use-module (haunt html) #:use-module (ice-9 match) #:use-module (jakob dynamic capabilities common) #:use-module (jakob dynamic captcha) @@ -23,6 +24,7 @@ #:use-module (jakob dynamic logging) #:use-module (jakob dynamic notify) #:use-module (jakob dynamic util) + #:use-module (jakob theme) #:use-module (json) #:use-module (squee) #:use-module (srfi srfi-1) @@ -148,10 +150,21 @@ This is a wrapper around `get-comments-by-slug'." (assoc-value form-data "reply-to") #f) (request-originating-network request))) - (values (build-response - #:code 307 - #:headers '((Location . "https://jakob.space"))) - (scm->json-string `((success . #t))))) + (if (equal? "application/json" (assoc-ref (request-headers request) 'accept)) + (values (build-response #:code 202 + #:headers '((content-type . (application/json)))) + (scm->json-string `((success . #t)))) + (values (build-response #:code 202 + #:headers '((content-type . (text/html)))) + (sxml->html-string + (theme #:title "Comment Posted!" + #:content + `(div (h2 "Comment successfully posted!") + (p "Thanks! Comments on this site are subject to " + (em "manual approval") + ", so it may be some time before you see your comment. " + "But if you're seeing this, we did receive it!") + (p (a (@ (href "/")) "Click here to return to the homepage.")))))))) (let ((form-data (decode-form body))) (unless (assoc "slug" form-data) (panic "missing param `slug'")) (unless (assoc "name" form-data) (panic "missing param `name'")) |