From 9c5b0826878db77c435e01b24e0e30e7cb7673d3 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 10 Jan 2020 08:04:48 +0000 Subject: [PATCH] Fix: Show possible managers again --- src/Module/Settings/Delegation.php | 32 ++++++++++-------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/src/Module/Settings/Delegation.php b/src/Module/Settings/Delegation.php index de3e10038..a8f203fca 100644 --- a/src/Module/Settings/Delegation.php +++ b/src/Module/Settings/Delegation.php @@ -102,29 +102,19 @@ class Delegation extends BaseSettingsModule // find every contact who might be a candidate for delegation $potentials = []; + $nicknames = []; - $contacts = DBA::selectToArray( - 'contact', - ['nurl'], - [ - "`self` = 0 AND SUBSTRING_INDEX(`nurl`, '/', 3) = ? AND `uid` = ? AND `network` = ?", - Strings::normaliseLink(DI::baseUrl()), - local_user(), - Protocol::DFRN, - ] - ); - if ($contacts) { - $nicknames = []; - foreach ($contacts as $contact) { - $nicknames[] = "'" . DBA::escape(basename($contact['nurl'])) . "'"; - } + $condition = ['baseurl' => DI::baseUrl(), 'self' => false, 'uid' => local_user(), 'blocked' => false]; + $contacts = DBA::select('contact', ['nick'], $condition); + while ($contact = DBA::fetch($contacts)) { + $nicknames[] = $contact['nick']; + } - // get user records for all potential page delegates who are not already delegates or managers - $potentialDelegateUsers = DBA::selectToArray('user', ['uid', 'username', 'nickname'], ['nickname' => $nicknames]); - foreach ($potentialDelegateUsers as $user) { - if (!in_array($user['uid'], $uids)) { - $potentials[] = $user; - } + // get user records for all potential page delegates who are not already delegates or managers + $potentialDelegateUsers = DBA::selectToArray('user', ['uid', 'username', 'nickname'], ['nickname' => $nicknames]); + foreach ($potentialDelegateUsers as $user) { + if (!in_array($user['uid'], $uids)) { + $potentials[] = $user; } }