X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FProtocol%2FActivityPub%2FReceiver.php;h=f830f857a745e0752ccf5bc2de2a5c575db4b839;hb=108f15a94e70524f579d591f9b6da2ac4eeb98d1;hp=1d425600d81b76ded4dda6f4819c1690e60e2751;hpb=5306622225343b7d2753fa842f1f18de31d2600e;p=friendica.git diff --git a/src/Protocol/ActivityPub/Receiver.php b/src/Protocol/ActivityPub/Receiver.php index 1d425600d8..f830f857a7 100644 --- a/src/Protocol/ActivityPub/Receiver.php +++ b/src/Protocol/ActivityPub/Receiver.php @@ -556,7 +556,7 @@ class Receiver // Check if the potential receiver is following the actor // Exception: The receiver is targetted via "to" or this is a comment if ((($element != 'as:to') && empty($replyto)) || ($contact['contact-type'] == Contact::TYPE_COMMUNITY)) { - $networks = [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]; + $networks = Protocol::FEDERATED; $condition = ['nurl' => Strings::normaliseLink($actor), 'rel' => [Contact::SHARING, Contact::FRIEND], 'network' => $networks, 'archive' => false, 'pending' => false, 'uid' => $contact['uid']]; @@ -591,7 +591,7 @@ class Receiver public static function getReceiverForActor($actor, $tags) { $receivers = []; - $networks = [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]; + $networks = Protocol::FEDERATED; $condition = ['nurl' => Strings::normaliseLink($actor), 'rel' => [Contact::SHARING, Contact::FRIEND, Contact::FOLLOWER], 'network' => $networks, 'archive' => false, 'pending' => false]; $contacts = DBA::select('contact', ['uid', 'rel'], $condition); @@ -657,27 +657,14 @@ class Receiver */ public static function switchContact($cid, $uid, $url) { - $profile = ActivityPub::probeProfile($url); - if (empty($profile)) { - return; - } - - Logger::log('Switch contact ' . $cid . ' (' . $profile['url'] . ') for user ' . $uid . ' to ActivityPub'); - - $photo = defaults($profile, 'photo', null); - unset($profile['photo']); - unset($profile['baseurl']); - unset($profile['guid']); - - $profile['nurl'] = Strings::normaliseLink($profile['url']); - DBA::update('contact', $profile, ['id' => $cid]); + Contact::updateFromProbe($cid, '', true); - Contact::updateAvatar($photo, $uid, $cid); + Logger::log('Switch contact ' . $cid . ' (' . $url . ') for user ' . $uid . ' to ActivityPub'); // Send a new follow request to be sure that the connection still exists if (($uid != 0) && DBA::exists('contact', ['id' => $cid, 'rel' => [Contact::SHARING, Contact::FRIEND]])) { - ActivityPub\Transmitter::sendActivity('Follow', $profile['url'], $uid); - Logger::log('Send a new follow request to ' . $profile['url'] . ' for user ' . $uid, Logger::DEBUG); + ActivityPub\Transmitter::sendActivity('Follow', $url, $uid); + Logger::log('Send a new follow request to ' . $url . ' for user ' . $uid, Logger::DEBUG); } }