diff options
author | Griffin Smith <grfn@gws.fyi> | 2020-07-28T22·29-0400 |
---|---|---|
committer | glittershark <grfn@gws.fyi> | 2020-07-31T02·05+0000 |
commit | 94796399e246d395811e33a5f2da50157881386c (patch) | |
tree | dd54b668a4405830e7d392ae63cfad1cfb0b0a00 /web/panettone/src/model.lisp | |
parent | 8e7ba41a3486a53de139486b75d72a349d13c415 (diff) |
feat(web/panettone): Display issue history r/1510
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>
Diffstat (limited to 'web/panettone/src/model.lisp')
-rw-r--r-- | web/panettone/src/model.lisp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/web/panettone/src/model.lisp b/web/panettone/src/model.lisp index 0f14cede4e5d..1ea0214f512a 100644 --- a/web/panettone/src/model.lisp +++ b/web/panettone/src/model.lisp @@ -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 ;;; |