Verified Commit 36c1ee35 authored by Bert Peters via aur-dev's avatar Bert Peters via aur-dev Committed by Kevin Morris
Browse files

Send request notifications to co-maintainers

This is in addition to the current recipients. Co-maintainers should
also be made aware when their package has pending requests.

NOTE: This commit was slightly modified to resolve cherry-pick
conflicts in `pu`.
parent 37232f71
Pipeline #12283 passed with stage
in 7 minutes and 17 seconds
...@@ -445,9 +445,12 @@ class RequestOpenNotification(Notification): ...@@ -445,9 +445,12 @@ class RequestOpenNotification(Notification):
'SELECT DISTINCT Users.Email FROM PackageRequests ' + 'SELECT DISTINCT Users.Email FROM PackageRequests ' +
'INNER JOIN PackageBases ' + 'INNER JOIN PackageBases ' +
'ON PackageBases.ID = PackageRequests.PackageBaseID ' + 'ON PackageBases.ID = PackageRequests.PackageBaseID ' +
'LEFT JOIN PackageComaintainers ' +
'ON PackageComaintainers.PackageBaseID = PackageRequests.PackageBaseID ' +
'INNER JOIN Users ' + 'INNER JOIN Users ' +
'ON Users.ID = PackageRequests.UsersID ' + 'ON Users.ID = PackageRequests.UsersID ' +
'OR Users.ID = PackageBases.MaintainerUID ' + 'OR Users.ID = PackageBases.MaintainerUID ' +
'OR Users.ID = PackageComaintainers.UsersID ' +
'WHERE PackageRequests.ID = ? AND ' + 'WHERE PackageRequests.ID = ? AND ' +
'Users.Suspended = 0', [reqid]) 'Users.Suspended = 0', [reqid])
self._to = aurweb.config.get('options', 'aur_request_ml') self._to = aurweb.config.get('options', 'aur_request_ml')
...@@ -499,13 +502,17 @@ class RequestOpenNotification(Notification): ...@@ -499,13 +502,17 @@ class RequestOpenNotification(Notification):
class RequestCloseNotification(Notification): class RequestCloseNotification(Notification):
def __init__(self, conn, uid, reqid, reason): def __init__(self, conn, uid, reqid, reason):
self._user = username_from_id(conn, uid) if int(uid) else None self._user = username_from_id(conn, uid) if int(uid) else None
cur = conn.execute( cur = conn.execute(
'SELECT DISTINCT Users.Email FROM PackageRequests ' + 'SELECT DISTINCT Users.Email FROM PackageRequests ' +
'INNER JOIN PackageBases ' + 'INNER JOIN PackageBases ' +
'ON PackageBases.ID = PackageRequests.PackageBaseID ' + 'ON PackageBases.ID = PackageRequests.PackageBaseID ' +
'LEFT JOIN PackageComaintainers ' +
'ON PackageComaintainers.PackageBaseID = PackageRequests.PackageBaseID ' +
'INNER JOIN Users ' + 'INNER JOIN Users ' +
'ON Users.ID = PackageRequests.UsersID ' + 'ON Users.ID = PackageRequests.UsersID ' +
'OR Users.ID = PackageBases.MaintainerUID ' + 'OR Users.ID = PackageBases.MaintainerUID ' +
'OR Users.ID = PackageComaintainers.UsersID ' +
'WHERE PackageRequests.ID = ? AND ' + 'WHERE PackageRequests.ID = ? AND ' +
'Users.Suspended = 0', [reqid]) 'Users.Suspended = 0', [reqid])
self._to = aurweb.config.get('options', 'aur_request_ml') self._to = aurweb.config.get('options', 'aur_request_ml')
......
...@@ -369,6 +369,23 @@ test_expect_success 'Test subject and body of request close notifications (auto- ...@@ -369,6 +369,23 @@ test_expect_success 'Test subject and body of request close notifications (auto-
test_cmp actual expected test_cmp actual expected
' '
test_expect_success 'Test Cc of request close notification with co-maintainer.' '
cat <<-EOD | sqlite3 aur.db &&
/* Use package base IDs which can be distinguished from user IDs. */
INSERT INTO PackageComaintainers (PackageBaseID, UsersID, Priority) VALUES (1001, 3, 1);
EOD
>sendmail.out &&
"$NOTIFY" request-close 0 3001 accepted &&
grep ^Cc: sendmail.out >actual &&
cat <<-EOD >expected &&
Cc: user@localhost, tu@localhost, dev@localhost
EOD
test_cmp actual expected &&
cat <<-EOD | sqlite3 aur.db
DELETE FROM PackageComaintainers;
EOD
'
test_expect_success 'Test subject and body of request close notifications with closure comment.' ' test_expect_success 'Test subject and body of request close notifications with closure comment.' '
cat <<-EOD | sqlite3 aur.db && cat <<-EOD | sqlite3 aur.db &&
UPDATE PackageRequests SET ClosureComment = "This is a test closure comment." WHERE ID = 3001; UPDATE PackageRequests SET ClosureComment = "This is a test closure comment." WHERE ID = 3001;
......
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