feat(panettone): Add a settings page

Add a user settings page, with a single checkbox that allows disabling
receiving all email notifications.

Change-Id: Ibef2a497cd59f93b695ff8b9cd36047e514e00c2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2806
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: tazjin <mail@tazj.in>
This commit is contained in:
Griffin Smith 2021-04-03 14:27:37 -04:00 committed by glittershark
parent 8d3ab61e7c
commit 3ec15ec9f9
4 changed files with 70 additions and 6 deletions

View file

@ -55,6 +55,24 @@ database connection."
(:select '* :from 'user-settings :where (:= 'user-dn dn))))
(insert-dao (make-instance 'user-settings :user-dn dn))))
(defun update-user-settings (settings &rest attrs)
"Update the fields of the settings for USER with the given ATTRS, which is a
plist of slot and value"
(check-type settings user-settings)
(when-let ((set-fields
(iter
(for slot in '(enable-email-notifications))
(for new-value = (getf attrs slot))
(appending
(progn
(setf (slot-value settings slot) new-value)
(list slot new-value))))))
(execute
(sql-compile
`(:update user-settings
:set ,@set-fields
:where (:= user-dn ,(user-dn settings)))))))
(define-constant +issue-statuses+ '(:open :closed)
:test #'equal)