about summary refs log tree commit diff
path: root/web/panettone/src/model.lisp
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2021-04-03T18·40-0400
committerglittershark <grfn@gws.fyi>2021-04-04T14·17+0000
commit606d2af2da946c9ddf15e737d77d9b193b7725bc (patch)
tree9a003e8f5fe4a1455b6339d021a617ae59da7feb /web/panettone/src/model.lisp
parent3ec15ec9f9b4f010f32630cc3cef19120c90ed28 (diff)
feat(panettone): Send emails when issues are closed r/2429
Send notification emails to the same group of users who receive
notifications on issue comments when issues are marked as closed. This
also takes the opportunity to generalize issue notification emails a
bit, and lay the groundwork for (but not implement) explicit issue
subscriber lists.

Change-Id: Ie2572ed3ad0207d415b4c362438f772925e7a2c5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2807
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'web/panettone/src/model.lisp')
-rw-r--r--web/panettone/src/model.lisp14
1 files changed, 14 insertions, 0 deletions
diff --git a/web/panettone/src/model.lisp b/web/panettone/src/model.lisp
index d7d1af924c29..4fa51026a086 100644
--- a/web/panettone/src/model.lisp
+++ b/web/panettone/src/model.lisp
@@ -395,6 +395,19 @@ ISSUE-ID, which should be a plist of initforms, and return an instance of
           :where (:= 'issue-id issue-id))
          :column))
 
+(defun issue-subscribers (issue-id)
+  "Returns a list of user DNs who should receive notifications for actions taken
+  on ISSUE-ID.
+
+Currently this is implemented as the author of issue plus all the users who have
+commented on the issue, but in the future we likely want to also allow
+explicitly subscribing to / unsubscribing from individual issues."
+  (let ((issue (get-issue issue-id)))
+    (adjoin (author-dn issue)
+            (issue-commenter-dns issue-id)
+            :test #'equal)))
+
+
 (comment
  (connect-postgres)
  (ddl/init)
@@ -403,5 +416,6 @@ ISSUE-ID, which should be a plist of initforms, and return an instance of
                :author-dn "cn=glittershark,ou=users,dc=tvl,dc=fyi")
 
  (issue-commenter-dns 1)
+ (issue-subscribers 1)
 
  )