about summary refs log tree commit diff
path: root/web
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2020-08-03T13·27-0400
committerglittershark <grfn@gws.fyi>2020-08-03T13·40+0000
commit117e7316a00768e17f654a3c64a9eb5fb45aad72 (patch)
treecabd3db6acfa6312cce5de4ba1613ab59b353466 /web
parent708e94532d8b483a29ec46ae3f822b96fca9a796 (diff)
fix(web/panettone): Fix more calls to (id nil) in new issue form r/1564
Change-Id: Id514d80e00005b7b7eb2f305e92af33ca70d6964
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1594
Tested-by: BuildkiteCI
Reviewed-by: lukegb <lukegb@tvl.fyi>
Diffstat (limited to 'web')
-rw-r--r--web/panettone/src/panettone.lisp67
1 files changed, 35 insertions, 32 deletions
diff --git a/web/panettone/src/panettone.lisp b/web/panettone/src/panettone.lisp
index 5473b2717987..7594c3ab2408 100644
--- a/web/panettone/src/panettone.lisp
+++ b/web/panettone/src/panettone.lisp
@@ -224,38 +224,41 @@
      (render/issue-list :issues issues))))
 
 (defun render/issue-form (&optional issue message)
-  (render ()
-    (:header
-     (:h1
-      (who:esc
-       (if (and issue (id issue))
-           "Edit Issue" "New Issue"))))
-    (:main
-     (render/alert message)
-     (:form :method "post"
-            :action (if (id issue)
-                        (format nil "/issues/~A"
-                                (id issue))
-                        "/issues")
-            :class "issue-form"
-            (:div
-             (:input :type "text"
-                     :id "subject"
-                     :name "subject"
-                     :placeholder "Subject"
-                     :value (subject issue)))
-
-            (:div
-             (:textarea :name "body"
-                        :placeholder "Description"
-                        :rows 10
-                        (who:esc (body issue))))
-
-            (:input :type "submit"
-                    :value
-                    (if (id issue)
-                        "Save Issue"
-                        "Create Issue"))))))
+  (let ((editing (and issue (id issue))))
+    (render ()
+      (:header
+       (:h1
+        (who:esc
+         (if editing "Edit Issue" "New Issue"))))
+      (:main
+       (render/alert message)
+       (:form :method "post"
+              :action (if editing
+                          (format nil "/issues/~A"
+                                  (id issue))
+                          "/issues")
+              :class "issue-form"
+              (:div
+               (:input :type "text"
+                       :id "subject"
+                       :name "subject"
+                       :placeholder "Subject"
+                       :value (when editing
+                                (subject issue))))
+
+              (:div
+               (:textarea :name "body"
+                          :placeholder "Description"
+                          :rows 10
+                          (who:esc
+                           (when editing
+                             (body issue)))))
+
+              (:input :type "submit"
+                      :value
+                      (if editing
+                          "Save Issue"
+                          "Create Issue")))))))
 
 (defun render/new-comment (issue-id)
   (who:with-html-output (*standard-output*)