Commit b70f048b authored by Lukas Fleischer's avatar Lukas Fleischer
Browse files

Add package base name in request close notifications



Mention both the package base name and the request type in the subject
of request closure notification.

Implements FS#41607.
Signed-off-by: Lukas Fleischer's avatarLukas Fleischer <lfleischer@archlinux.org>
parent 16795eaf
......@@ -443,9 +443,14 @@ class RequestCloseNotification(Notification):
'WHERE PackageRequests.ID = ?', [reqid])
self._to = aurweb.config.get('options', 'aur_request_ml')
self._cc = [row[0] for row in cur.fetchall()]
cur = conn.execute('SELECT ClosureComment FROM PackageRequests ' +
'WHERE ID = ?', [reqid])
self._text = cur.fetchone()[0]
cur = conn.execute('SELECT PackageRequests.ClosureComment, ' +
'RequestTypes.Name, ' +
'PackageRequests.PackageBaseName ' +
'FROM PackageRequests ' +
'INNER JOIN RequestTypes ' +
'ON RequestTypes.ID = PackageRequests.ReqTypeID ' +
'WHERE PackageRequests.ID = ?', [reqid])
self._text, self._reqtype, self._pkgbase = cur.fetchone()
self._reqid = int(reqid)
self._reason = reason
......@@ -453,7 +458,10 @@ class RequestCloseNotification(Notification):
return [(self._to, 'en')]
def get_subject(self, lang):
return '[PRQ#%d] Request %s' % (self._reqid, self._reason.title())
return '[PRQ#%d] %s Request for %s %s' % (self._reqid,
self._reqtype.title(),
self._pkgbase,
self._reason.title())
def get_body(self, lang):
if self._user:
......
......@@ -376,7 +376,7 @@ test_expect_success "Check whether package requests are closed when disowning."
SSH_ORIGINAL_COMMAND="disown foobar" AUR_USER=user AUR_PRIVILEGED=0 \
"$GIT_SERVE" 2>&1 &&
cat <<-EOD >expected &&
Subject: [PRQ#1] Request Accepted
Subject: [PRQ#1] Orphan Request for foobar Accepted
EOD
grep "^Subject.*PRQ" sendmail.out >sendmail.parts &&
test_cmp sendmail.parts expected &&
......
......@@ -304,7 +304,7 @@ test_expect_success 'Test subject and body of request close notifications.' '
"$NOTIFY" request-close 1 1 accepted &&
grep ^Subject: sendmail.out >actual &&
cat <<-EOD >expected &&
Subject: [PRQ#1] Request Accepted
Subject: [PRQ#1] Deletion Request for foobar Accepted
EOD
test_cmp actual expected &&
sed -n "/^\$/,\$p" sendmail.out | base64 -d >actual &&
......@@ -322,7 +322,7 @@ test_expect_success 'Test subject and body of request close notifications (auto-
"$NOTIFY" request-close 0 1 accepted &&
grep ^Subject: sendmail.out >actual &&
cat <<-EOD >expected &&
Subject: [PRQ#1] Request Accepted
Subject: [PRQ#1] Deletion Request for foobar Accepted
EOD
test_cmp actual expected &&
sed -n "/^\$/,\$p" sendmail.out | base64 -d >actual &&
......@@ -342,7 +342,7 @@ test_expect_success 'Test subject and body of request close notifications with c
"$NOTIFY" request-close 1 1 accepted &&
grep ^Subject: sendmail.out >actual &&
cat <<-EOD >expected &&
Subject: [PRQ#1] Request Accepted
Subject: [PRQ#1] Deletion Request for foobar Accepted
EOD
test_cmp actual expected &&
sed -n "/^\$/,\$p" sendmail.out | base64 -d >actual &&
......
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