]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/ACL.php
Merge pull request #7943 from MrPetovan/bug/7920-api-fix-followers-friends-ids
[friendica.git] / src / Core / ACL.php
index 044f61aebce5da518f10e7e5e61d6d46702dc90a..64e03d47190e752902d99351fbf191ba3ab789ac 100644 (file)
@@ -258,10 +258,20 @@ class ACL extends BaseObject
         */
        public static function getContactListByUserId(int $user_id)
        {
-               $acl_contacts = Contact::selectToArray(
-                       ['id', 'name', 'addr', 'micro'],
-                       ['uid' => $user_id, 'pending' => false, 'rel' => [Contact::FOLLOWER, Contact::FRIEND]]
+               $fields = ['id', 'name', 'addr', 'micro'];
+               $params = ['order' => ['name']];
+               $acl_contacts = Contact::selectToArray($fields,
+                       ['uid' => $user_id, 'self' => false, 'blocked' => false, 'archive' => false, 'deleted' => false,
+                       'pending' => false, 'rel' => [Contact::FOLLOWER, Contact::FRIEND]], $params
                );
+
+               $acl_forums = Contact::selectToArray($fields,
+                       ['uid' => $user_id, 'self' => false, 'blocked' => false, 'archive' => false, 'deleted' => false,
+                       'pending' => false, 'contact-type' => Contact::TYPE_COMMUNITY], $params
+               );
+
+               $acl_contacts = array_merge($acl_forums, $acl_contacts);
+
                array_walk($acl_contacts, function (&$value) {
                        $value['type'] = 'contact';
                });
@@ -325,6 +335,10 @@ class ACL extends BaseObject
         */
        public static function getFullSelectorHTML(Page $page, array $user = null, bool $for_federation = false, array $default_permissions = [])
        {
+               if (empty($user['uid'])) {
+                       return '';
+               }
+
                $page->registerFooterScript(Theme::getPathForFile('asset/typeahead.js/dist/typeahead.bundle.js'));
                $page->registerFooterScript(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.js'));
                $page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.css'));