feat(web/panettone): Disallow comments with an empty body
Change-Id: Ic77a0caf419389e8460bf7e5688293f3a588caa4 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1405 Tested-by: BuildkiteCI Reviewed-by: kanepyork <rikingcoding@gmail.com>
This commit is contained in:
parent
943a4c9214
commit
add588e634
1 changed files with 14 additions and 10 deletions
|
@ -429,16 +429,20 @@ updated issue"
|
||||||
("/issues/:id/comments" :decorators (@auth)
|
("/issues/:id/comments" :decorators (@auth)
|
||||||
:method :post)
|
:method :post)
|
||||||
(&path (id 'integer) &post body)
|
(&path (id 'integer) &post body)
|
||||||
(handler-case
|
(flet ((redirect-to-issue ()
|
||||||
(progn
|
(hunchentoot:redirect (format nil "/issues/~A" id))))
|
||||||
(cl-prevalence:execute-transaction
|
(if (string= body "")
|
||||||
(add-comment *p-system* id
|
(redirect-to-issue)
|
||||||
:body body
|
(handler-case
|
||||||
:author-dn (dn *user*)))
|
(progn
|
||||||
(cl-prevalence:snapshot *p-system*)
|
(cl-prevalence:execute-transaction
|
||||||
(hunchentoot:redirect (format nil "/issues/~A" id)))
|
(add-comment *p-system* id
|
||||||
(issue-not-found (_)
|
:body body
|
||||||
(render/not-found "Issue"))))
|
:author-dn (dn *user*)))
|
||||||
|
(cl-prevalence:snapshot *p-system*)
|
||||||
|
(redirect-to-issue))
|
||||||
|
(issue-not-found (_)
|
||||||
|
(render/not-found "Issue"))))))
|
||||||
|
|
||||||
(defroute close-issue
|
(defroute close-issue
|
||||||
("/issues/:id/close" :decorators (@auth)
|
("/issues/:id/close" :decorators (@auth)
|
||||||
|
|
Loading…
Add table
Reference in a new issue