Fix processing of pkgbase_get_comaintainers()

pkgbase_get_comaintainers() returns an array of user names, not an array
of user IDs.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
Lukas Fleischer 2015-05-22 19:53:19 +02:00
parent 0b8c11a37a
commit c6e09def2b
2 changed files with 11 additions and 8 deletions

View file

@ -11,7 +11,7 @@ check_sid();
html_header(__("Disown Package")); html_header(__("Disown Package"));
$maintainer_uids = array(pkgbase_maintainer_uid($base_id)); $maintainer_uids = array(pkgbase_maintainer_uid($base_id));
$comaintainer_uids = pkgbase_get_comaintainers($base_id); $comaintainers = pkgbase_get_comaintainers($base_id);
if (has_credential(CRED_PKGBASE_DISOWN, $maintainer_uids)): ?> if (has_credential(CRED_PKGBASE_DISOWN, $maintainer_uids)): ?>
<div class="box"> <div class="box">
@ -26,9 +26,9 @@ if (has_credential(CRED_PKGBASE_DISOWN, $maintainer_uids)): ?>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
<p> <p>
<?php if (count($comaintainer_uids) > 0 && !has_credential(CRED_PKGBASE_DISOWN)): ?> <?php if (count($comaintainers) > 0 && !has_credential(CRED_PKGBASE_DISOWN)): ?>
<?= __('By selecting the checkbox, you confirm that you want to disown the package and transfer ownership to %s%s%s.', <?= __('By selecting the checkbox, you confirm that you want to disown the package and transfer ownership to %s%s%s.',
'<strong>', $comaintainer_uids[0], '</strong>'); ?> '<strong>', $comaintainers[0], '</strong>'); ?>
<?php else: ?> <?php else: ?>
<?= __('By selecting the checkbox, you confirm that you want to disown the package.') ?> <?= __('By selecting the checkbox, you confirm that you want to disown the package.') ?>
<?php endif; ?> <?php endif; ?>

View file

@ -646,15 +646,18 @@ function pkgbase_adopt ($base_ids, $action=true, $via) {
} }
} else { } else {
foreach ($base_ids as $base_id) { foreach ($base_ids as $base_id) {
$uids = pkgbase_get_comaintainers($base_id); $comaintainers = pkgbase_get_comaintainers($base_id);
if (count($comaintainers) > 0) {
$uid = uid_from_username($comaintainers[0]);
$q = "UPDATE PackageBases "; $q = "UPDATE PackageBases ";
$q.= "SET MaintainerUID = " . $uids[0] . " "; $q.= "SET MaintainerUID = " . $uid . " ";
$q.= "WHERE ID = " . $base_id; $q.= "WHERE ID = " . $base_id;
$dbh->exec($q); $dbh->exec($q);
} }
} }
} }
}
if ($action) { if ($action) {
pkgbase_notify($base_ids); pkgbase_notify($base_ids);