]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/ActivityPub/Processor.php
Merge pull request #7255 from annando/issue-7223
[friendica.git] / src / Protocol / ActivityPub / Processor.php
index a5f6607edcadda62f1d77fd5c7fb797e8955839e..9eb1506a2878deba0a71064205f189732960087d 100644 (file)
@@ -567,7 +567,7 @@ class Processor
                        DBA::update('contact', ['hub-verify' => $activity['id'], 'protocol' => Protocol::ACTIVITYPUB], ['id' => $cid]);
                        $contact = DBA::selectFirst('contact', [], ['id' => $cid, 'network' => Protocol::NATIVE_SUPPORT]);
                } else {
-                       $contact = false;
+                       $contact = [];
                }
 
                $item = ['author-id' => Contact::getIdForURL($activity['actor']),
@@ -578,7 +578,11 @@ class Processor
                // Ensure that the contact has got the right network type
                self::switchContact($item['author-id']);
 
-               Contact::addRelationship($owner, $contact, $item, '', false, $note);
+               $result = Contact::addRelationship($owner, $contact, $item, false, $note);
+               if ($result === true) {
+                       ActivityPub\Transmitter::sendContactAccept($item['author-link'], $item['author-id'], $owner['uid']);
+               }
+
                $cid = Contact::getIdForURL($activity['actor'], $uid);
                if (empty($cid)) {
                        return;