mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
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`.
This commit is contained in:
parent
37232f71ee
commit
36c1ee35a7
2 changed files with 24 additions and 0 deletions
|
@ -445,9 +445,12 @@ class RequestOpenNotification(Notification):
|
|||
'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')
|
||||
|
@ -499,13 +502,17 @@ 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 ' +
|
||||
'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;
|
||||
|
|
Loading…
Add table
Reference in a new issue