feat(web/panettone): Display issue history

Display the history of an issue (which currently is just opening and
closing) inline with the issue's comments on the issue show page

Change-Id: Id167bceef765cb4c24e86983d1dcd6624d0e5956
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1497
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
This commit is contained in:
Griffin Smith 2020-07-28 18:29:30 -04:00 committed by glittershark
parent 8e7ba41a34
commit 94796399e2
6 changed files with 94 additions and 35 deletions

View file

@ -55,6 +55,7 @@
(body :col-type string :initarg :body :accessor body :col-default "")
(author-dn :col-type string :initarg :author-dn :accessor author-dn)
(comments :type list :accessor issue-comments)
(events :type list :accessor issue-events)
(num-comments :type integer :accessor num-comments)
(status :col-type issue_status
:initarg :status
@ -221,6 +222,22 @@ NOTE: This makes a database query, so be wary of N+1 queries"
:where (:= 'issue-id issue-id))
(:asc 'created-at))))
(defmethod slot-unbound (cls (issue issue) (slot (eql 'events)))
(declare (ignore cls) (ignore slot))
(setf (issue-events issue) (issue-events (id issue))))
(defmethod issue-events ((issue-id integer))
"Return a list of all events with the given ISSUE-ID, sorted oldest first.
NOTE: This makes a database query, so be wary of N+1 queries"
(query-dao
'issue-event
(:order-by
(:select '*
:from 'issue-events
:where (:= 'issue-id issue-id))
(:asc 'created-at))))
;;;
;;; Writing
;;;