]> git.mxchange.org Git - friendica.git/commitdiff
Enable meta groups in Model\Group::getIdsByContactId
authorHypolite Petovan <hypolite@mrpetovan.com>
Fri, 8 Nov 2019 03:02:34 +0000 (22:02 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Mon, 20 Jan 2020 12:32:47 +0000 (07:32 -0500)
- Don't return early if contact isn't part of any group in PermissionSet::get

src/Model/Group.php
src/Model/PermissionSet.php

index c38e78000b6a25247625d5afacee96ca3aee87ab..199ff1ebd7e112950286b5889cac3b56e18e61d3 100644 (file)
@@ -117,6 +117,16 @@ class Group
                }
                DBA::close($stmt);
 
+               // Meta-groups
+               $contact = Contact::getById($cid, ['rel']);
+               if ($contact['rel'] == Contact::FOLLOWER || $contact['rel'] == Contact::FRIEND) {
+                       $return[] = self::FOLLOWERS;
+               }
+
+               if ($contact['rel'] == Contact::FRIEND) {
+                       $return[] = self::MUTUALS;
+               }
+
                return $return;
        }
 
index de943c977c3841ae5292c5af2ea3c57b776bf174..fbcc1738d716f921489853906abb60913672f31c 100644 (file)
@@ -82,14 +82,9 @@ class PermissionSet
                        $groups = Group::getIdsByContactId($contact_id);
                }
 
-               if (empty($groups) || !is_array($groups)) {
-                       return [];
-               }
-
                $group_str = '<<>>'; // should be impossible to match
-
-               foreach ($groups as $g) {
-                       $group_str .= '|<' . intval($g) . '>';
+               foreach ($groups as $group_id) {
+                       $group_str .= '|<' . preg_quote($group_id) . '>';
                }
 
                $contact_str = '<' . $contact_id . '>';