- $this->id = $userContactId;
- $this->following = in_array($userContact['rel'] ?? 0, [Contact::SHARING, Contact::FRIEND]);
- $this->followed_by = in_array($userContact['rel'] ?? 0, [Contact::FOLLOWER, Contact::FRIEND]);
- $this->blocking = (bool)$userContact['blocked'] ?? false;
- $this->muting = (bool)$userContact['readonly'] ?? false;
- $this->muting_notifications = (bool)$userContact['readonly'] ?? false;
- $this->requested = (bool)$userContact['pending'] ?? false;
- $this->domain_blocking = Network::isUrlBlocked($userContact['url'] ?? '');
+ $this->id = (string)$contactId;
+ $this->following = false;
+ $this->requested = false;
+ $this->endorsed = false;
+ $this->followed_by = false;
+ $this->muting = $muted;
+ $this->muting_notifications = false;
+ $this->showing_reblogs = true;
+ $this->notifying = false;
+ $this->blocking = $blocked;
+ $this->domain_blocking = Network::isUrlBlocked($contactRecord['url'] ?? '');
+ $this->blocked_by = false;
+ $this->note = '';
+
+ if ($contactRecord['uid'] != 0) {
+ $this->following = !$contactRecord['pending'] && in_array($contactRecord['rel'] ?? 0, [Contact::SHARING, Contact::FRIEND]);
+ $this->requested = (bool)($contactRecord['pending'] ?? false);
+ $this->followed_by = !$contactRecord['pending'] && in_array($contactRecord['rel'] ?? 0, [Contact::FOLLOWER, Contact::FRIEND]);
+ $this->muting = (bool)($contactRecord['readonly'] ?? false) || $muted;
+ $this->notifying = (bool)$contactRecord['notify_new_posts'] ?? false;
+ $this->blocking = (bool)($contactRecord['blocked'] ?? false) || $blocked;
+ $this->note = $contactRecord['info'];
+ }