Prevent merging a package base with itself

Instead of deleting the package, show an error message if a user tries
to merge a package base with itself.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2014-07-23 15:37:31 +02:00
parent 446d4537d4
commit 48ae736068
2 changed files with 11 additions and 4 deletions

View file

@ -69,12 +69,15 @@ if (check_token()) {
}
else {
$merge_base_id = pkgbase_from_name($_POST['merge_Into']);
if ($merge_base_id) {
list($ret, $output) = pkgbase_delete($ids, $merge_base_id, $via);
unset($_GET['ID']);
} else {
if (!$merge_base_id) {
$output = __("Cannot find package to merge votes and comments into.");
$ret = false;
} elseif (in_array($merge_base_id, $ids)) {
$output = __("Cannot merge a package base with itself.");
$ret = false;
} else {
list($ret, $output) = pkgbase_delete($ids, $merge_base_id, $via);
unset($_GET['ID']);
}
}
}