summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2020-04-05 23:52:21 +0200
committerRicardo Wurmus <rekado@elephly.net>2020-04-06 00:08:02 +0200
commit18087c486b6b8c2c3a99b9a0b47a02b4004b1e81 (patch)
tree338f9327ca5c62019570761dcf308abe15a5d5ac
parentbf23cc7829198be6ff6a26f2e5ee4effee516ec5 (diff)
controller: Record the current issue id in a cookie.
-rw-r--r--mumi/web/controller.scm14
1 files changed, 10 insertions, 4 deletions
diff --git a/mumi/web/controller.scm b/mumi/web/controller.scm
index 376873c..62a9b00 100644
--- a/mumi/web/controller.scm
+++ b/mumi/web/controller.scm
@@ -97,15 +97,21 @@
'(error . "There was an error submitting your comment!"))
(_ #f))))
(if bug
- (let ((headers
+ ;; Record the current issue id in an encrypted cookie.
+ ;; This will be verified when posting a comment.
+ (let* ((cookie-header
+ (set-session %session-manager `((issue-id . ,id))))
+ (headers
(cond
((bug-archived bug)
;; Tell browser to cache this for 12 hours.
- '((cache-control . ((max-age . 43200)))))
+ (cons cookie-header
+ '((cache-control . ((max-age . 43200))))))
((bug-done bug)
;; Tell browser to cache this for 1 hour.
- '((cache-control . ((max-age . 3600)))))
- (else '()))))
+ (cons cookie-header
+ '((cache-control . ((max-age . 3600))))))
+ (else (list cookie-header)))))
(render-html (issue-page bug message)
#:extra-headers headers))
(render-html (unknown id)))))