mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
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>
This commit is contained in:
parent
8a465182ba
commit
4645bcbacb
4 changed files with 20 additions and 6 deletions
|
@ -105,7 +105,7 @@ if (check_token()) {
|
||||||
$ret = false;
|
$ret = false;
|
||||||
}
|
}
|
||||||
} elseif (current_action("do_CloseRequest")) {
|
} elseif (current_action("do_CloseRequest")) {
|
||||||
list($ret, $output) = pkgreq_close($_POST['reqid'], $_POST['reason']);
|
list($ret, $output) = pkgreq_close($_POST['reqid'], $_POST['reason'], $_POST['comments']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['comment'])) {
|
if (isset($_REQUEST['comment'])) {
|
||||||
|
|
|
@ -540,7 +540,7 @@ function pkgbase_delete ($atype, $base_ids, $merge_base_id, $via) {
|
||||||
$dbh->exec($q);
|
$dbh->exec($q);
|
||||||
|
|
||||||
if ($via) {
|
if ($via) {
|
||||||
pkgreq_close(intval($via), 'accepted');
|
pkgreq_close(intval($via), 'accepted', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(true, __("The selected packages have been deleted."));
|
return array(true, __("The selected packages have been deleted."));
|
||||||
|
@ -598,7 +598,7 @@ function pkgbase_adopt ($atype, $base_ids, $action=true, $via) {
|
||||||
$dbh->exec($q);
|
$dbh->exec($q);
|
||||||
|
|
||||||
if ($via) {
|
if ($via) {
|
||||||
pkgreq_close(intval($via), 'accepted');
|
pkgreq_close(intval($via), 'accepted', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action) {
|
if ($action) {
|
||||||
|
|
|
@ -156,10 +156,11 @@ function pkgreq_file($ids, $type, $merge_into, $comments) {
|
||||||
* @global string $AUR_REQUEST_ML The request notification mailing list
|
* @global string $AUR_REQUEST_ML The request notification mailing list
|
||||||
* @param int $id The package request to close
|
* @param int $id The package request to close
|
||||||
* @param string $reason Whether the request was accepted or rejected
|
* @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
|
* @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_LOCATION;
|
||||||
global $AUR_REQUEST_ML;
|
global $AUR_REQUEST_ML;
|
||||||
|
|
||||||
|
@ -202,8 +203,13 @@ function pkgreq_close($id, $reason) {
|
||||||
*/
|
*/
|
||||||
$username = username_from_sid($_COOKIE['AURSID']);
|
$username = username_from_sid($_COOKIE['AURSID']);
|
||||||
$body = "Request #" . intval($id) . " has been " . $reason . " by " .
|
$body = "Request #" . intval($id) . " has been " . $reason . " by " .
|
||||||
$username . " [1].\n\n" .
|
$username . " [1]";
|
||||||
"[1] " . $AUR_LOCATION . get_user_uri($username) . "\n";
|
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);
|
$body = wordwrap($body, 70);
|
||||||
$headers = "MIME-Version: 1.0\r\n" .
|
$headers = "MIME-Version: 1.0\r\n" .
|
||||||
"Content-type: text/plain; charset=UTF-8\r\n";
|
"Content-type: text/plain; charset=UTF-8\r\n";
|
||||||
|
|
|
@ -4,6 +4,10 @@
|
||||||
<?= __('Use this form to close the request for package base %s%s%s.',
|
<?= __('Use this form to close the request for package base %s%s%s.',
|
||||||
'<strong>', htmlspecialchars($pkgbase_name), '</strong>'); ?>
|
'<strong>', htmlspecialchars($pkgbase_name), '</strong>'); ?>
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
<em><?= __('Note') ?>:</em>
|
||||||
|
<?= __('The comments field can be left empty. However, it is highly recommended to add a comment when rejecting a request.') ?>
|
||||||
|
</p>
|
||||||
<form action="<?= get_uri('/pkgbase/'); ?>" method="post">
|
<form action="<?= get_uri('/pkgbase/'); ?>" method="post">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<input type="hidden" name="reqid" value="<?= $pkgreq_id ?>" />
|
<input type="hidden" name="reqid" value="<?= $pkgreq_id ?>" />
|
||||||
|
@ -15,6 +19,10 @@
|
||||||
<option value="rejected"><?= __('Rejected') ?></option>
|
<option value="rejected"><?= __('Rejected') ?></option>
|
||||||
</select>
|
</select>
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
<label for="id_comments"><?= __("Comments") ?>:</label>
|
||||||
|
<textarea name="comments" id="id_comments" rows="5" cols="50"></textarea>
|
||||||
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<input type="submit" class="button" name="do_CloseRequest" value="<?= __("Close Request") ?>" />
|
<input type="submit" class="button" name="do_CloseRequest" value="<?= __("Close Request") ?>" />
|
||||||
</p>
|
</p>
|
||||||
|
|
Loading…
Add table
Reference in a new issue