From ebeeb7518241bea945b6c372fe07fb20abf020f3 Mon Sep 17 00:00:00 2001 From: Jakob L. Kreuze Date: Sat, 19 Nov 2022 12:42:09 -0500 Subject: [dynamic] Prettify success response --- haunt/jakob/dynamic/capabilities/comments.scm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'haunt/jakob/dynamic/capabilities/comments.scm') diff --git a/haunt/jakob/dynamic/capabilities/comments.scm b/haunt/jakob/dynamic/capabilities/comments.scm index 54e1846..d3cb812 100644 --- a/haunt/jakob/dynamic/capabilities/comments.scm +++ b/haunt/jakob/dynamic/capabilities/comments.scm @@ -15,9 +15,12 @@ ;;; . (define-module (jakob dynamic capabilities comments) + #:use-module (haunt html) #:use-module (ice-9 match) #:use-module (jakob dynamic captcha) + #:use-module (jakob dynamic capabilities comment-form) #:use-module (jakob dynamic util) + #:use-module (jakob theme) #:use-module (json) #:use-module (squee) #:use-module (web request) @@ -103,8 +106,11 @@ This is a wrapper around `get-comments-by-slug'." (assoc-value form-data "email") (assoc-value form-data "url") (assoc-value form-data "comment"))) - (values '((content-type . (application/json))) - (scm->json-string `((success . #t))))) + (values '((content-type . (text/html))) + (sxml->html-string + (theme + #:content (render-comment-form-success (assoc-value form-data "slug")) + #:title "Success!")))) (let ((form-data (decode-form body))) (if (valid-comment? form-data) (insert-comment form-data) -- cgit v1.3