3 namespace Friendica\Object\Api\Mastodon;
5 use Friendica\BaseEntity;
6 use Friendica\Model\Contact;
7 use Friendica\Util\Network;
12 * @see https://docs.joinmastodon.org/api/entities/#relationship
14 class Relationship extends BaseEntity
19 protected $following = false;
21 protected $followed_by = false;
23 protected $blocking = false;
25 protected $muting = false;
27 protected $muting_notifications = false;
29 protected $requested = false;
31 protected $domain_blocking = false;
36 protected $showing_reblogs = true;
41 protected $endorsed = false;
44 * @param int $userContactId Contact row Id with uid != 0
45 * @param array $userContact Full Contact table record with uid != 0
47 public function __construct(int $userContactId, array $userContact = [])
49 $this->id = $userContactId;
50 $this->following = in_array($userContact['rel'] ?? 0, [Contact::SHARING, Contact::FRIEND]);
51 $this->followed_by = in_array($userContact['rel'] ?? 0, [Contact::FOLLOWER, Contact::FRIEND]);
52 $this->blocking = (bool)$userContact['blocked'] ?? false;
53 $this->muting = (bool)$userContact['readonly'] ?? false;
54 $this->muting_notifications = (bool)$userContact['readonly'] ?? false;
55 $this->requested = (bool)$userContact['pending'] ?? false;
56 $this->domain_blocking = Network::isUrlBlocked($userContact['url'] ?? '');