Allow users to unflag packages they flagged themselves

Sometimes, a user accidentally flags a package out-of-date. Allow users
to unflag packages that they flagged themselves, thereby providing a way
to undo these actions.

Implements FS#46145.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
Lukas Fleischer 2015-08-30 16:32:34 +02:00
parent e1a258bd83
commit 57db4814a4
5 changed files with 8 additions and 5 deletions

View file

@ -21,8 +21,9 @@ $packager = username_from_id($row["PackagerUID"]);
if ($row["MaintainerUID"] !== NULL) {
$maintainers = array_merge(array($row["MaintainerUID"]), pkgbase_get_comaintainer_uids(array($base_id)));
} else {
$maintainers = NULL;
$maintainers = array();
}
$unflaggers = array_merge($maintainers, array($row["FlaggerUID"]));
$votes = $row['NumVotes'];
$popularity = $row['Popularity'];

View file

@ -11,7 +11,7 @@
<li><span class="flagged"><?php if ($row["OutOfDateTS"] !== NULL) { echo __('Flagged out-of-date')." (${out_of_date_time})"; } ?></span></li>
<?php if ($row["OutOfDateTS"] === NULL): ?>
<li><?= html_action_form($base_uri . 'flag/', "do_Flag", __('Flag package out-of-date')) ?></li>
<?php elseif (($row["OutOfDateTS"] !== NULL) && has_credential(CRED_PKGBASE_UNFLAG, $maintainers)): ?>
<?php elseif (($row["OutOfDateTS"] !== NULL) && has_credential(CRED_PKGBASE_UNFLAG, $unflaggers)): ?>
<li><?= html_action_form($base_uri . 'unflag/', "do_UnFlag", __('Unflag package')) ?></li>
<?php endif; ?>

View file

@ -20,8 +20,9 @@ $packager = username_from_id($row["PackagerUID"]);
if ($row["MaintainerUID"] !== NULL) {
$maintainers = array_merge(array($row["MaintainerUID"]), pkgbase_get_comaintainer_uids(array($base_id)));
} else {
$maintainers = NULL;
$maintainers = array();
}
$unflaggers = array_merge($maintainers, array($row["FlaggerUID"]));
$votes = $row['NumVotes'];
$popularity = $row['Popularity'];