Skip to content
Snippets Groups Projects
Verified Commit be64ca7b 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.
parent 040bb0d7
No related branches found
No related tags found
No related merge requests found
Pipeline #12274 passed
......@@ -435,9 +435,12 @@ class RequestOpenNotification(Notification):
cur = conn.execute('SELECT DISTINCT Users.Email FROM PackageRequests ' +
'INNER JOIN PackageBases ' +
'ON PackageBases.ID = PackageRequests.PackageBaseID ' +
'LEFT JOIN PackageComaintainers ' +
'ON PackageComaintainers.PackageBaseID = PackageRequests.PackageBaseID ' +
'INNER JOIN Users ' +
'ON Users.ID = PackageRequests.UsersID ' +
'OR Users.ID = PackageBases.MaintainerUID ' +
'OR Users.ID = PackageComaintainers.UsersID ' +
'WHERE PackageRequests.ID = ? AND ' +
'Users.Suspended = 0', [reqid])
self._to = aurweb.config.get('options', 'aur_request_ml')
......@@ -492,9 +495,12 @@ class RequestCloseNotification(Notification):
cur = conn.execute('SELECT DISTINCT Users.Email FROM PackageRequests ' +
'INNER JOIN PackageBases ' +
'ON PackageBases.ID = PackageRequests.PackageBaseID ' +
'LEFT JOIN PackageComaintainers ' +
'ON PackageComaintainers.PackageBaseID = PackageRequests.PackageBaseID ' +
'INNER JOIN Users ' +
'ON Users.ID = PackageRequests.UsersID ' +
'OR Users.ID = PackageBases.MaintainerUID ' +
'OR Users.ID = PackageComaintainers.UsersID ' +
'WHERE PackageRequests.ID = ? AND ' +
'Users.Suspended = 0', [reqid])
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-
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.' '
cat <<-EOD | sqlite3 aur.db &&
UPDATE PackageRequests SET ClosureComment = "This is a test closure comment." WHERE ID = 3001;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment