mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
fix: add recipients to BCC when email is hidden
Package requests are sent to the ML as well as users (CC). For those who chose to hide their mail address, we should add them to the BCC list instead. Signed-off-by: moson-mo <mo-son@mailbox.org>
This commit is contained in:
parent
9fe8d524ff
commit
f3f8c0a871
4 changed files with 68 additions and 6 deletions
|
@ -45,6 +45,9 @@ class Notification:
|
|||
def get_cc(self):
|
||||
return []
|
||||
|
||||
def get_bcc(self):
|
||||
return []
|
||||
|
||||
def get_body_fmt(self, lang):
|
||||
body = ""
|
||||
for line in self.get_body(lang).splitlines():
|
||||
|
@ -114,7 +117,7 @@ class Notification:
|
|||
server.login(user, passwd)
|
||||
|
||||
server.set_debuglevel(0)
|
||||
deliver_to = [to] + self.get_cc()
|
||||
deliver_to = [to] + self.get_cc() + self.get_bcc()
|
||||
server.sendmail(sender, deliver_to, msg.as_bytes())
|
||||
server.quit()
|
||||
|
||||
|
@ -578,10 +581,11 @@ class RequestOpenNotification(Notification):
|
|||
),
|
||||
)
|
||||
.filter(and_(PackageRequest.ID == reqid, User.Suspended == 0))
|
||||
.with_entities(User.Email)
|
||||
.with_entities(User.Email, User.HideEmail)
|
||||
.distinct()
|
||||
)
|
||||
self._cc = [u.Email for u in query]
|
||||
self._cc = [u.Email for u in query if u.HideEmail == 0]
|
||||
self._bcc = [u.Email for u in query if u.HideEmail == 1]
|
||||
|
||||
pkgreq = (
|
||||
db.query(PackageRequest.Comments).filter(PackageRequest.ID == reqid).first()
|
||||
|
@ -598,6 +602,9 @@ class RequestOpenNotification(Notification):
|
|||
def get_cc(self):
|
||||
return self._cc
|
||||
|
||||
def get_bcc(self):
|
||||
return self._bcc
|
||||
|
||||
def get_subject(self, lang):
|
||||
return "[PRQ#%d] %s Request for %s" % (
|
||||
self._reqid,
|
||||
|
@ -665,10 +672,11 @@ class RequestCloseNotification(Notification):
|
|||
),
|
||||
)
|
||||
.filter(and_(PackageRequest.ID == reqid, User.Suspended == 0))
|
||||
.with_entities(User.Email)
|
||||
.with_entities(User.Email, User.HideEmail)
|
||||
.distinct()
|
||||
)
|
||||
self._cc = [u.Email for u in query]
|
||||
self._cc = [u.Email for u in query if u.HideEmail == 0]
|
||||
self._bcc = [u.Email for u in query if u.HideEmail == 1]
|
||||
|
||||
pkgreq = (
|
||||
db.query(PackageRequest)
|
||||
|
@ -695,6 +703,9 @@ class RequestCloseNotification(Notification):
|
|||
def get_cc(self):
|
||||
return self._cc
|
||||
|
||||
def get_bcc(self):
|
||||
return self._bcc
|
||||
|
||||
def get_subject(self, lang):
|
||||
return "[PRQ#%d] %s Request for %s %s" % (
|
||||
self._reqid,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue