Require comments when flagging packages out-of-date

Implements FS#42827.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
Lukas Fleischer 2015-08-31 18:29:06 +02:00
parent 6b7e26a2d1
commit 396e50bdc8
6 changed files with 27 additions and 12 deletions

View file

@ -49,7 +49,12 @@ $output = "";
$fragment = "";
if (check_token()) {
if (current_action("do_Flag")) {
list($ret, $output) = pkgbase_flag($ids);
if (strlen($_POST['comments']) >= 3) {
list($ret, $output) = pkgbase_flag($ids, $_POST['comments']);
} else {
$output = __("The selected packages have not been flagged, please enter a comment.");
$ret = false;
}
} elseif (current_action("do_UnFlag")) {
list($ret, $output) = pkgbase_unflag($ids);
} elseif (current_action("do_Adopt")) {

View file

@ -25,12 +25,17 @@ if (has_credential(CRED_PKGBASE_FLAG)): ?>
<p>
<?= __('Please do %snot%s use this form to report bugs. Use the package comments instead.',
'<strong>', '</strong>'); ?>
<?= __('Enter details on why the package is out-of-date below, preferably including links to the release announcement or the new release tarball.'); ?>
</p>
<form action="<?= get_uri('/pkgbase/'); ?>" method="post">
<fieldset>
<input type="hidden" name="IDs[<?= $base_id ?>]" value="1" />
<input type="hidden" name="ID" value="<?= $base_id ?>" />
<input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" />
<p>
<label for="id_comments"><?= __("Comments") ?>:</label>
<textarea name="comments" id="id_comments" rows="5" cols="50"></textarea>
</p>
<p><input type="submit" class="button" name="do_Flag" value="<?= __("Flag") ?>" /></p>
</fieldset>
</form>