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:
parent
8d3ab61e7c
commit
3ec15ec9f9
4 changed files with 70 additions and 6 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue