]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #5827 from annando/follow-on-switch
authorHypolite Petovan <hypolite@mrpetovan.com>
Fri, 5 Oct 2018 23:39:38 +0000 (19:39 -0400)
committerGitHub <noreply@github.com>
Fri, 5 Oct 2018 23:39:38 +0000 (19:39 -0400)
Send a follow request upon contact switch to AP

src/Protocol/ActivityPub/Receiver.php

index 30d710702a4182d7019514922fa711aa7a7ec874..5c644176f02db55d42443c4165836456a4879d48 100644 (file)
@@ -357,11 +357,11 @@ class Receiver
        }
 
        /**
-        * @brief 
+        * @brief Switches existing contacts to ActivityPub
         *
-        * @param $cid
+        * @param integer $cid Contact ID
         * @param integer $uid User ID
-        * @param $url
+        * @param string $url Profile URL
         */
        private static function switchContact($cid, $uid, $url)
        {
@@ -370,7 +370,7 @@ class Receiver
                        return;
                }
 
-               logger('Switch contact ' . $cid . ' (' . $profile['url'] . ') for user ' . $uid . ' from OStatus to ActivityPub');
+               logger('Switch contact ' . $cid . ' (' . $profile['url'] . ') for user ' . $uid . ' to ActivityPub');
 
                $photo = $profile['photo'];
                unset($profile['photo']);
@@ -381,7 +381,11 @@ class Receiver
 
                Contact::updateAvatar($photo, $uid, $cid);
 
-               /// @todo Send a new follow request to be sure that the connection still exists
+               // 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('Send a new follow request to ' . $profile['url'] . ' for user ' . $uid, LOGGER_DEBUG);
+               }
        }
 
        /**