Commit 1626d4d2 authored by Lukas Fleischer's avatar Lukas Fleischer
Browse files

notify: Fix notification of request initiator



Reimplement get_request_recipients() such that it always returns the
email addresses of the package base maintainer and the request
initiator, instead of the email address of the user triggering the
request status change.

Fixes FS#48238.

Signed-off-by: Lukas Fleischer's avatarLukas Fleischer <lfleischer@archlinux.org>
parent 443ccfab
...@@ -115,11 +115,14 @@ def get_update_recipients(cur, pkgbase_id, uid): ...@@ -115,11 +115,14 @@ def get_update_recipients(cur, pkgbase_id, uid):
return [row[0] for row in cur.fetchall()] return [row[0] for row in cur.fetchall()]
def get_request_recipients(cur, pkgbase_id, uid): def get_request_recipients(cur, reqid):
cur.execute('SELECT DISTINCT Users.Email FROM Users ' + cur.execute('SELECT DISTINCT Users.Email FROM PackageRequests ' +
'INNER JOIN PackageBases ' + 'INNER JOIN PackageBases ' +
'ON PackageBases.MaintainerUID = Users.ID WHERE ' + 'ON PackageBases.ID = PackageRequests.PackageBaseID ' +
'Users.ID = %s OR PackageBases.ID = %s', [uid, pkgbase_id]) 'INNER JOIN Users ' +
'ON Users.ID = PackageRequests.UsersID ' +
'OR Users.ID = PackageBases.MaintainerUID ' +
'WHERE PackageRequests.ID = %s', [reqid])
return [row[0] for row in cur.fetchall()] return [row[0] for row in cur.fetchall()]
...@@ -301,7 +304,7 @@ def request_open(cur, uid, reqid, reqtype, pkgbase_id, merge_into=None): ...@@ -301,7 +304,7 @@ def request_open(cur, uid, reqid, reqtype, pkgbase_id, merge_into=None):
user = username_from_id(cur, uid) user = username_from_id(cur, uid)
pkgbase = pkgbase_from_id(cur, pkgbase_id) pkgbase = pkgbase_from_id(cur, pkgbase_id)
to = [aur_request_ml] to = [aur_request_ml]
cc = get_request_recipients(cur, pkgbase_id, uid) cc = get_request_recipients(cur, reqid)
text = get_request_comment(cur, reqid) text = get_request_comment(cur, reqid)
user_uri = aur_location + '/account/' + user + '/' user_uri = aur_location + '/account/' + user + '/'
...@@ -333,9 +336,8 @@ def request_open(cur, uid, reqid, reqtype, pkgbase_id, merge_into=None): ...@@ -333,9 +336,8 @@ def request_open(cur, uid, reqid, reqtype, pkgbase_id, merge_into=None):
def request_close(cur, uid, reqid, reason): def request_close(cur, uid, reqid, reason):
user = username_from_id(cur, uid) user = username_from_id(cur, uid)
pkgbase_id = pkgbase_from_pkgreq(cur, reqid)
to = [aur_request_ml] to = [aur_request_ml]
cc = get_request_recipients(cur, pkgbase_id, uid) cc = get_request_recipients(cur, reqid)
text = get_request_closure_comment(cur, reqid) text = get_request_closure_comment(cur, reqid)
user_uri = aur_location + '/account/' + user + '/' user_uri = aur_location + '/account/' + user + '/'
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment