From 1f2123ce316fac9e259b8dd44e03ef24c1b2e490 Mon Sep 17 00:00:00 2001 From: Jakob L. Kreuze Date: Tue, 14 Mar 2023 18:07:28 -0400 Subject: Merge branch 'feature/comment-reactions' commit 626e7b65e9a7c00ed68c78400e03e27cbd4c77c0 Author: Jakob L. Kreuze Date: Tue Mar 14 18:05:47 2023 -0400 Indicator when reaction attempt succeeded commit e446f67898a05091b2f05df9ed81ca73764f6069 Author: Jakob L. Kreuze Date: Tue Mar 14 18:05:16 2023 -0400 Bug fixes commit ab6edd57158574df80fe33138e99a317c64a0861 Author: Jakob L. Kreuze Date: Sun Mar 12 08:43:03 2023 -0400 Better error reporting for reactions commit 9d0638a78333ca35aa1bd12c5c6ced8bd2d7687d Author: Jakob L. Kreuze Date: Sun Mar 12 08:38:49 2023 -0400 Update comment and weblabels commit 4a8378715c2e4e559731b319cac920c00cb32116 Author: Jakob L. Kreuze Date: Sun Mar 12 08:37:40 2023 -0400 Allow for more emojis commit 655f40bb267cc6df82356a0422146e555b94cf99 Author: Jakob L. Kreuze Date: Sat Mar 11 19:35:05 2023 -0500 Rate limit `put-reaction' commit 6463a9f09032f22c8e39ccea757b8a7054f199ba Author: Jakob L. Kreuze Date: Sat Mar 11 19:33:53 2023 -0500 Guard against non-emoji reactions commit 32e642f3789d163fae18824ec04e7e833713b26c Author: Jakob L. Kreuze Date: Sat Mar 11 19:32:05 2023 -0500 Reaction UI commit 4d07077daedc30271be69c86c855795affdea860 Author: Jakob L. Kreuze Date: Sat Mar 11 16:51:46 2023 -0500 Address parsing issues in `put-reaction' endpoint --- haunt/jakob/dynamic/capabilities/comments.scm | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'haunt/jakob/dynamic/capabilities') diff --git a/haunt/jakob/dynamic/capabilities/comments.scm b/haunt/jakob/dynamic/capabilities/comments.scm index 98560b0..996c549 100644 --- a/haunt/jakob/dynamic/capabilities/comments.scm +++ b/haunt/jakob/dynamic/capabilities/comments.scm @@ -188,16 +188,14 @@ 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))) - (unless reactions (panic "no such comment")) + (let* ((id (assoc-value form-data "id")) + (reaction (assoc-value form-data "reaction")) + (reactions (comment-reactions id))) + (unless id (panic "no such comment")) + (unless (emoji? reaction) (panic "invalid reaction")) (set-reactions id (add-reaction reactions reaction)) (values '((content-type . (application/json))) (scm->json-string `((success . #t))))))) -- cgit v1.3