X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FACL.php;h=a2db32afc459c44cc21bcaa6315230d7411cccb6;hb=f826ce70ceb9f810a16b70d3d77b9ba2c8d9097d;hp=a4acf58bad4fb0fb54590ad47e63e268379af375;hpb=2d326c8a27bbc1698bd09049391ed13c129683fd;p=friendica.git diff --git a/src/Core/ACL.php b/src/Core/ACL.php index a4acf58bad..a2db32afc4 100644 --- a/src/Core/ACL.php +++ b/src/Core/ACL.php @@ -51,7 +51,7 @@ class ACL * @return string * @throws \Exception */ - public static function getMessageContactSelectHTML(int $selected = null) + public static function getMessageContactSelectHTML(int $selected = null): string { $o = ''; @@ -62,25 +62,7 @@ class ACL $page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.css')); $page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput-typeahead.css')); - $condition = [ - 'uid' => local_user(), - 'self' => false, - 'blocked' => false, - 'pending' => false, - 'archive' => false, - 'deleted' => false, - 'rel' => [Contact::FOLLOWER, Contact::SHARING, Contact::FRIEND], - 'network' => Protocol::SUPPORT_PRIVATE, - ]; - - $contacts = Contact::selectToArray( - ['id', 'name', 'addr', 'micro'], - DBA::mergeConditions($condition, ["`notify` != ''"]) - ); - - $arr = ['contact' => $contacts, 'entry' => $o]; - - Hook::callAll(DI::args()->getModuleName() . '_pre_recipient', $arr); + $contacts = self::getValidMessageRecipientsForUser(DI::userSession()->getLocalUserId()); $tpl = Renderer::getMarkupTemplate('acl/message_recipient.tpl'); $o = Renderer::replaceMacros($tpl, [ @@ -93,6 +75,25 @@ class ACL return $o; } + public static function getValidMessageRecipientsForUser(int $uid): array + { + $condition = [ + 'uid' => $uid, + 'self' => false, + 'blocked' => false, + 'pending' => false, + 'archive' => false, + 'deleted' => false, + 'rel' => [Contact::FOLLOWER, Contact::SHARING, Contact::FRIEND], + 'network' => Protocol::SUPPORT_PRIVATE, + ]; + + return Contact::selectToArray( + ['id', 'name', 'addr', 'micro', 'url', 'nick'], + DBA::mergeConditions($condition, ["`notify` != ''"]) + ); + } + /** * Returns a minimal ACL block for self-only permissions *