From 94796399e246d395811e33a5f2da50157881386c Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Tue, 28 Jul 2020 18:29:30 -0400 Subject: 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 --- web/panettone/src/model.lisp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'web/panettone/src/model.lisp') 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 ;;; -- cgit 1.4.1