mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Distinguish auto-accepted requests
Before commit 9746a65
(Port notification routines to Python,
2015-06-27), notification emails for automatically closed requests
explicitly stated that the action was taken "automatically by the Arch
User Repository package request system". When porting the notification
routines to Python, this feature was overlooked and emails sent by the
new script always reported that the requester triggered the acceptance
or rejection of a request.
This patch reimplements the old behavior such that notifications no
longer look as if the requester had accepted the request himself.
Reported-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
parent
fbf3e54057
commit
60cdad28ee
2 changed files with 14 additions and 7 deletions
|
@ -41,7 +41,10 @@ def send_notification(to, subject, body, refs, headers={}):
|
|||
wrapped = ''
|
||||
for line in body.splitlines():
|
||||
wrapped += textwrap.fill(line, break_long_words=False) + '\n'
|
||||
body = wrapped + '\n' + refs
|
||||
if refs:
|
||||
body = wrapped + '\n' + refs
|
||||
else:
|
||||
body = wrapped
|
||||
|
||||
for recipient in to:
|
||||
msg = email.mime.text.MIMEText(body, 'plain', 'utf-8')
|
||||
|
@ -377,20 +380,24 @@ 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)
|
||||
to = [aur_request_ml]
|
||||
cc = get_request_recipients(cur, reqid)
|
||||
text = get_request_closure_comment(cur, reqid)
|
||||
|
||||
user_uri = aur_location + '/account/' + user + '/'
|
||||
|
||||
subject = '[PRQ#%d] Request %s' % (int(reqid), reason.title())
|
||||
body = 'Request #%d has been %s by %s [1]' % (int(reqid), reason, user)
|
||||
if int(uid):
|
||||
user = username_from_id(cur, uid)
|
||||
user_uri = aur_location + '/account/' + user + '/'
|
||||
body = 'Request #%d has been %s by %s [1]' % (int(reqid), reason, user)
|
||||
refs = '[1] ' + user_uri
|
||||
else:
|
||||
body = 'Request #%d has been %s automatically by the Arch User ' \
|
||||
'Repository package request system' % (int(reqid), reason)
|
||||
refs = None
|
||||
if text.strip() == '':
|
||||
body += '.'
|
||||
else:
|
||||
body += ':\n\n' + text
|
||||
refs = '[1] ' + user_uri
|
||||
thread_id = '<pkg-request-' + reqid + '@aur.archlinux.org>'
|
||||
headers = headers_reply(thread_id)
|
||||
headers.update(headers_cc(cc))
|
||||
|
|
|
@ -221,7 +221,7 @@ function pkgreq_close($id, $reason, $comments, $auto_close=false) {
|
|||
|
||||
$dbh = DB::connect();
|
||||
$id = intval($id);
|
||||
$uid = uid_from_sid($_COOKIE["AURSID"]);
|
||||
$uid = $auto_close ? 0 : uid_from_sid($_COOKIE["AURSID"]);
|
||||
|
||||
if (!$auto_close && !has_credential(CRED_PKGREQ_CLOSE)) {
|
||||
return array(false, __("Only TUs and developers can close requests."));
|
||||
|
|
Loading…
Add table
Reference in a new issue