[aur-dev] [PATCH 1/3] notify: Reintroduce Message-ID again
In commit 7b57e0e (Set Message-ID when sending package request emails, 2014-07-01), we changed the code responsible for sending notifications such that the value of the Message-ID header is set deterministically in the first email referring to a request. Unfortunately, this was forgotten when porting the notification routines to Python in 9746a65 (Port notification routines to Python, 2015-06-27) and later fixed by 092e00f (notify: Fix references in request notifications, 2015-10-10). However, when fixing another bug, the old behavior of not setting a Message-ID was restored by d87b138 (notify: Fix merging of header dicts, 2015-10-26). Revert that particular change once more and add a comment such that the line gets extra attention, should it be changed in the future. Fixes FS#48239. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org> --- scripts/notify.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/notify.py b/scripts/notify.py index 56534ae..2dd8805 100755 --- a/scripts/notify.py +++ b/scripts/notify.py @@ -324,7 +324,8 @@ def request_open(cur, uid, reqid, reqtype, pkgbase_id, merge_into=None): refs = '[1] ' + user_uri + '\n' refs += '[2] ' + pkgbase_uri + '\n' thread_id = '<pkg-request-' + reqid + '@aur.archlinux.org>' - headers = headers_reply(thread_id) + # Use a deterministic Message-ID for the first email referencing a request. + headers = headers_msgid(thread_id) headers.update(headers_cc(cc)) send_notification(to, subject, body, refs, headers) -- 2.7.1
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 <lfleischer@archlinux.org> --- scripts/notify.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/scripts/notify.py b/scripts/notify.py index 2dd8805..25102a2 100755 --- a/scripts/notify.py +++ b/scripts/notify.py @@ -115,11 +115,14 @@ def get_update_recipients(cur, pkgbase_id, uid): return [row[0] for row in cur.fetchall()] -def get_request_recipients(cur, pkgbase_id, uid): - cur.execute('SELECT DISTINCT Users.Email FROM Users ' + +def get_request_recipients(cur, reqid): + cur.execute('SELECT DISTINCT Users.Email FROM PackageRequests ' + 'INNER JOIN PackageBases ' + - 'ON PackageBases.MaintainerUID = Users.ID WHERE ' + - 'Users.ID = %s OR PackageBases.ID = %s', [uid, pkgbase_id]) + 'ON PackageBases.ID = PackageRequests.PackageBaseID ' + + '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()] @@ -301,7 +304,7 @@ def request_open(cur, uid, reqid, reqtype, pkgbase_id, merge_into=None): user = username_from_id(cur, uid) pkgbase = pkgbase_from_id(cur, pkgbase_id) to = [aur_request_ml] - cc = get_request_recipients(cur, pkgbase_id, uid) + cc = get_request_recipients(cur, reqid) text = get_request_comment(cur, reqid) user_uri = aur_location + '/account/' + user + '/' @@ -333,9 +336,8 @@ def request_open(cur, uid, reqid, reqtype, pkgbase_id, merge_into=None): def request_close(cur, uid, reqid, reason): user = username_from_id(cur, uid) - pkgbase_id = pkgbase_from_pkgreq(cur, reqid) 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) user_uri = aur_location + '/account/' + user + '/' -- 2.7.1
If a package base is unmaintained, there is no need to file an orphan request. Hide the option from the front-end in this case. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org> --- web/template/pkgreq_form.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/template/pkgreq_form.php b/web/template/pkgreq_form.php index 5bd2bfe..4fd7851 100644 --- a/web/template/pkgreq_form.php +++ b/web/template/pkgreq_form.php @@ -19,7 +19,9 @@ <select name="type" id="id_type" onchange="showHideMergeSection()"> <option value="deletion"><?= __('Deletion') ?></option> <option value="merge"><?= __('Merge') ?></option> + <?php if (pkgbase_maintainer_uid($base_id)): ?> <option value="orphan"><?= __('Orphan') ?></option> + <?php endif; ?> </select> </p> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> -- 2.7.1
participants (1)
-
Lukas Fleischer