Skip to content
Snippets Groups Projects

fix requests not being sent to the cc recipients

Closed Frederik Schwan requested to merge freswa/aurweb:master into master
1 file
+ 10
9
Compare changes
  • Side-by-side
  • Inline
  • From a SMTP pov, the To and Cc header are not read. The real recipient
    is stated at the begining of a send mail transaction.
    It's up to the client to collect this recipient list. Sendmail does this
    by reading the To and Cc header.
    smtplib doesn't do this when being invoked with an explicit To array.
    This commit adds the Cc people to the recipient array.
    The issue has been introduced by the switch from sendmail to smtplib.
+ 10
9
@@ -117,7 +117,6 @@ class Notification:
server.login(user, passwd)
server.set_debuglevel(0)
deliver_to = [to] + self.get_cc()
server.sendmail(sender, to, msg.as_bytes())
server.quit()
@@ -427,7 +426,8 @@ class RequestOpenNotification(Notification):
def __init__(self, conn, uid, reqid, reqtype, pkgbase_id, merge_into=None):
self._user = username_from_id(conn, uid)
self._pkgbase = pkgbase_from_id(conn, pkgbase_id)
cur = conn.execute('SELECT DISTINCT Users.Email FROM PackageRequests ' +
cur = conn.execute('SELECT DISTINCT Users.Email, Users.LangPreference ' +
'FROM PackageRequests ' +
'INNER JOIN PackageBases ' +
'ON PackageBases.ID = PackageRequests.PackageBaseID ' +
'INNER JOIN Users ' +
@@ -435,7 +435,7 @@ class RequestOpenNotification(Notification):
'OR Users.ID = PackageBases.MaintainerUID ' +
'WHERE PackageRequests.ID = ?', [reqid])
self._to = aurweb.config.get('options', 'aur_request_ml')
self._cc = [row[0] for row in cur.fetchall()]
self._cc = cur.fetchall()
cur = conn.execute('SELECT Comments FROM PackageRequests WHERE ID = ?',
[reqid])
self._text = cur.fetchone()[0]
@@ -444,10 +444,10 @@ class RequestOpenNotification(Notification):
self._merge_into = merge_into
def get_recipients(self):
return [(self._to, 'en')]
return [(self._to, 'en'), self._cc]
def get_cc(self):
return self._cc
return [row[0] for row in self._cc]
def get_subject(self, lang):
return '[PRQ#%d] %s Request for %s' % \
@@ -483,7 +483,8 @@ class RequestOpenNotification(Notification):
class RequestCloseNotification(Notification):
def __init__(self, conn, uid, reqid, reason):
self._user = username_from_id(conn, uid) if int(uid) else None
cur = conn.execute('SELECT DISTINCT Users.Email FROM PackageRequests ' +
cur = conn.execute('SELECT DISTINCT Users.Email, Users.LangPreference ' +
'FROM PackageRequests ' +
'INNER JOIN PackageBases ' +
'ON PackageBases.ID = PackageRequests.PackageBaseID ' +
'INNER JOIN Users ' +
@@ -491,7 +492,7 @@ class RequestCloseNotification(Notification):
'OR Users.ID = PackageBases.MaintainerUID ' +
'WHERE PackageRequests.ID = ?', [reqid])
self._to = aurweb.config.get('options', 'aur_request_ml')
self._cc = [row[0] for row in cur.fetchall()]
self._cc = cur.fetchall()
cur = conn.execute('SELECT PackageRequests.ClosureComment, ' +
'RequestTypes.Name, ' +
'PackageRequests.PackageBaseName ' +
@@ -504,10 +505,10 @@ class RequestCloseNotification(Notification):
self._reason = reason
def get_recipients(self):
return [(self._to, 'en')]
return [(self._to, 'en'), self._cc]
def get_cc(self):
return self._cc
return [row[0] for row in self._cc]
def get_subject(self, lang):
return '[PRQ#%d] %s Request for %s %s' % (self._reqid,
Loading