From 771658391218184966182fcb49669cc239eb5862 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 11 Dec 2019 03:29:57 -0500 Subject: [PATCH] Add Mastodon API entity Relationship class --- src/Api/Mastodon/Relationship.php | 59 +++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 src/Api/Mastodon/Relationship.php diff --git a/src/Api/Mastodon/Relationship.php b/src/Api/Mastodon/Relationship.php new file mode 100644 index 0000000000..18e249ba3e --- /dev/null +++ b/src/Api/Mastodon/Relationship.php @@ -0,0 +1,59 @@ +id = $contact['id']; + $relationship->following = in_array($contact['rel'], [Contact::SHARING, Contact::FRIEND]); + $relationship->followed_by = in_array($contact['rel'], [Contact::FOLLOWER, Contact::FRIEND]); + $relationship->blocking = (bool)$contact['blocked']; + $relationship->muting = (bool)$contact['readonly']; + $relationship->muting_notifications = (bool)$contact['readonly']; + $relationship->requested = (bool)$contact['pending']; + $relationship->domain_blocking = Network::isUrlBlocked($contact['url']); + // Unsupported + $relationship->showing_reblogs = true; + // Unsupported + $relationship->endorsed = false; + + return $relationship; + } +}