X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FObject%2FApi%2FMastodon%2FRelationship.php;h=42d0e73119bc315f6efccc7f99adec658ec50127;hb=32bb0976046ef9fa2296d0aeb39a01b0b916dc1e;hp=463eb97e04c5df2fa14e615d5743129af0dcaba4;hpb=45c2cc3887a620c6158a1093c05bca99a5a0d1d9;p=friendica.git diff --git a/src/Object/Api/Mastodon/Relationship.php b/src/Object/Api/Mastodon/Relationship.php index 463eb97e04..42d0e73119 100644 --- a/src/Object/Api/Mastodon/Relationship.php +++ b/src/Object/Api/Mastodon/Relationship.php @@ -1,6 +1,6 @@ id = $userContactId; - $this->following = in_array($userContact['rel'] ?? 0, [Contact::SHARING, Contact::FRIEND]); - $this->requested = (bool)$userContact['pending'] ?? false; + $this->id = (string)$contactId; + $this->following = false; + $this->requested = false; $this->endorsed = false; - $this->followed_by = in_array($userContact['rel'] ?? 0, [Contact::FOLLOWER, Contact::FRIEND]); - $this->muting = (bool)($userContact['readonly'] ?? false) || $muted; - $this->muting_notifications = $this->muting; + $this->followed_by = false; + $this->muting = $muted; + $this->muting_notifications = false; $this->showing_reblogs = true; - $this->notifying = (bool)$userContact['notify_new_posts'] ?? false; - $this->blocking = (bool)($userContact['blocked'] ?? false) || $blocked; - $this->domain_blocking = Network::isUrlBlocked($userContact['url'] ?? ''); + $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']; + } + return $this; } }