]> git.mxchange.org Git - friendica.git/commitdiff
Breakup public/user ID query results so can always query blocked status by CID
authorHank Grabowski <hankgrabowski@gmail.com>
Wed, 22 Feb 2023 17:07:57 +0000 (12:07 -0500)
committerHank Grabowski <hankgrabowski@gmail.com>
Wed, 22 Feb 2023 17:07:57 +0000 (12:07 -0500)
src/Factory/Api/Mastodon/Relationship.php

index 3c9dca3024cb1bdc43a1f94c2ba4b989ebc2b281..f1ca4a1f9e6a245f0ff6532a925d8f30b3cc5822 100644 (file)
@@ -38,14 +38,14 @@ class Relationship extends BaseFactory
        public function createFromContactId(int $contactId, int $uid): RelationshipEntity
        {
                $cdata = Contact::getPublicAndUserContactID($contactId, $uid);
-               if (!empty($cdata)) {
-                       $cid  = $cdata['user'];
-                       $pcid = $cdata['public'];
-               } else {
-                       $pcid = $cid = $contactId;
-               }
+               $pcid  = !empty($cdata['public']) ? $cdata['public'] : $contactId;
+               $cid   = !empty($cdata['user']) ? $cdata['user'] : $contactId;
 
-               return new RelationshipEntity($pcid, Contact::getById($cid),
-                       Contact\User::isBlocked($cid, $uid), Contact\User::isIgnored($cid, $uid));
+               return new RelationshipEntity(
+                       $pcid,
+                       Contact::getById($cid),
+                       Contact\User::isBlocked($cid, $uid),
+                       Contact\User::isIgnored($cid, $uid)
+               );
        }
 }