From 10768741cdc8c69240a8152d8195c2362c76535c Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 28 May 2022 18:06:37 +0200 Subject: fix(web/panettone): Only send emails if the email is known Upcoming changes to the authentication model may mean that user objects do not have an email address attached. Change-Id: I4fddb810f723c790d243f779714ca7f189a02aeb Reviewed-on: https://cl.tvl.fyi/c/depot/+/5770 Tested-by: BuildkiteCI Reviewed-by: grfn --- web/panettone/src/email.lisp | 5 +++-- web/panettone/src/packages.lisp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'web') diff --git a/web/panettone/src/email.lisp b/web/panettone/src/email.lisp index cb01c488a2a6..72b2e146b46a 100644 --- a/web/panettone/src/email.lisp +++ b/web/panettone/src/email.lisp @@ -41,8 +41,9 @@ values of `*smtp-server*', `*smtp-server-port*' and `*email-notification-from*'" "Sends an email notification to the user with DN with the given SUBJECT and MESSAGE, iff that user has not disabled email notifications" (when (user-has-email-notifications-enabled-p dn) - (when-let ((user (find-user-by-dn dn))) + (when-let* ((user (find-user-by-dn dn)) + (user-mail user)) (send-email-notification - :to (mail user) + :to user-mail :subject subject :message message)))) diff --git a/web/panettone/src/packages.lisp b/web/panettone/src/packages.lisp index 81d2bed728d4..d3e23d5b33ed 100644 --- a/web/panettone/src/packages.lisp +++ b/web/panettone/src/packages.lisp @@ -55,7 +55,7 @@ (defpackage panettone.email (:nicknames :email) (:use :cl) - (:import-from :alexandria :when-let) + (:import-from :alexandria :when-let :when-let*) (:import-from :panettone.model :settings-for-user :enable-email-notifications-p) (:import-from :panettone.authentication -- cgit 1.4.1