summaryrefslogtreecommitdiffstats
path: root/web/lib/pkgreqfuncs.inc.php
diff options
context:
space:
mode:
authorLukas Fleischer <archlinux@cryptocrack.de>2014-07-04 11:00:07 +0200
committerLukas Fleischer <archlinux@cryptocrack.de>2014-07-04 11:10:50 +0200
commit4645bcbacbc4fd2fba2a3f28d6cd23bdfb184a9d (patch)
treebf76716bc018a15d0206b61816f3e945a14912e1 /web/lib/pkgreqfuncs.inc.php
parent8a465182babccec10b8e789dbc871db3beb9bec5 (diff)
downloadaurweb-4645bcbacbc4fd2fba2a3f28d6cd23bdfb184a9d.tar.xz
Allow for adding a comment when closing a request
This allows Trusted Users to optionally add a comment when closing a request. The comment is included in the notification email that is sent to the requests mailing list. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'web/lib/pkgreqfuncs.inc.php')
-rw-r--r--web/lib/pkgreqfuncs.inc.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/web/lib/pkgreqfuncs.inc.php b/web/lib/pkgreqfuncs.inc.php
index 0309bc3..fccf0b2 100644
--- a/web/lib/pkgreqfuncs.inc.php
+++ b/web/lib/pkgreqfuncs.inc.php
@@ -156,10 +156,11 @@ function pkgreq_file($ids, $type, $merge_into, $comments) {
* @global string $AUR_REQUEST_ML The request notification mailing list
* @param int $id The package request to close
* @param string $reason Whether the request was accepted or rejected
+ * @param string $comments Comments to be added to the notification email
*
* @return array Tuple of success/failure indicator and error message
*/
-function pkgreq_close($id, $reason) {
+function pkgreq_close($id, $reason, $comments) {
global $AUR_LOCATION;
global $AUR_REQUEST_ML;
@@ -202,8 +203,13 @@ function pkgreq_close($id, $reason) {
*/
$username = username_from_sid($_COOKIE['AURSID']);
$body = "Request #" . intval($id) . " has been " . $reason . " by " .
- $username . " [1].\n\n" .
- "[1] " . $AUR_LOCATION . get_user_uri($username) . "\n";
+ $username . " [1]";
+ if (!empty(trim($comments))) {
+ $body .= ":\n\n" . $comments . "\n\n";
+ } else {
+ $body .= ".\n\n";
+ }
+ $body .= "[1] " . $AUR_LOCATION . get_user_uri($username) . "\n";
$body = wordwrap($body, 70);
$headers = "MIME-Version: 1.0\r\n" .
"Content-type: text/plain; charset=UTF-8\r\n";