Verified Commit 3bd4aa4c authored by Leonidas Spyropoulos's avatar Leonidas Spyropoulos Committed by Eli Schwartz
Browse files

Filter out current username from co-maintainers list.



Closes: #8
Signed-off-by: Leonidas Spyropoulos's avatarLeonidas Spyropoulos <artafinde@gmail.com>
Signed-off-by: Eli Schwartz's avatarEli Schwartz <eschwartz@archlinux.org>
parent 2a4f423e
...@@ -1189,7 +1189,8 @@ function pkgbase_get_comaintainer_uids($base_ids) { ...@@ -1189,7 +1189,8 @@ function pkgbase_get_comaintainer_uids($base_ids) {
* @return array Tuple of success/failure indicator and error message * @return array Tuple of success/failure indicator and error message
*/ */
function pkgbase_set_comaintainers($base_id, $users, $override=false) { function pkgbase_set_comaintainers($base_id, $users, $override=false) {
if (!$override && !has_credential(CRED_PKGBASE_EDIT_COMAINTAINERS, array(pkgbase_maintainer_uid($base_id)))) { $maintainer_uid = pkgbase_maintainer_uid($base_id);
if (!$override && !has_credential(CRED_PKGBASE_EDIT_COMAINTAINERS, array($maintainer_uid))) {
return array(false, __("You are not allowed to manage co-maintainers of this package base.")); return array(false, __("You are not allowed to manage co-maintainers of this package base."));
} }
...@@ -1207,9 +1208,12 @@ function pkgbase_set_comaintainers($base_id, $users, $override=false) { ...@@ -1207,9 +1208,12 @@ function pkgbase_set_comaintainers($base_id, $users, $override=false) {
if (!$uid) { if (!$uid) {
return array(false, __("Invalid user name: %s", $user)); return array(false, __("Invalid user name: %s", $user));
} elseif ($uid == $maintainer_uid) {
// silently ignore when maintainer == co-maintainer
continue;
} else {
$uids_new[] = $uid;
} }
$uids_new[] = $uid;
} }
$q = sprintf("SELECT UsersID FROM PackageComaintainers WHERE PackageBaseID = %d", $base_id); $q = sprintf("SELECT UsersID FROM PackageComaintainers WHERE PackageBaseID = %d", $base_id);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment