Merge pull request #12838 from HankG/blocks-status-fix

Correctly reflect blocked status in Mastodon Relationship Object
This commit is contained in:
Hypolite Petovan 2023-02-22 16:49:55 -05:00 committed by GitHub
commit 1cff849a94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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