]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/ActivityPub/Processor.php
Merge pull request #7189 from MrPetovan/bug/7183-archives-profile-widget
[friendica.git] / src / Protocol / ActivityPub / Processor.php
index b6f3486a2526f73948a573966f21c976b15dab55..fd84f494e2d597f172269b64e5790d1a5e4c420a 100644 (file)
@@ -64,10 +64,9 @@ class Processor
         *
         * @param array   $tags
         * @param boolean $sensitive
-        * @param array   $implicit_mentions List of profile URLs to skip
         * @return string with tags
         */
-       private static function constructTagString(array $tags, $sensitive)
+       private static function constructTagString(array $tags = null, $sensitive = false)
        {
                if (empty($tags)) {
                        return '';
@@ -174,7 +173,7 @@ class Processor
                        $item['object-type'] = ACTIVITY_OBJ_COMMENT;
                }
 
-               if (($activity['id'] != $activity['reply-to-id']) && !Item::exists(['uri' => $activity['reply-to-id']])) {
+               if (empty($activity['directmessage']) && ($activity['id'] != $activity['reply-to-id']) && !Item::exists(['uri' => $activity['reply-to-id']])) {
                        Logger::log('Parent ' . $activity['reply-to-id'] . ' not found. Try to refetch it.');
                        self::fetchMissingActivity($activity['reply-to-id'], $activity);
                }
@@ -531,7 +530,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']),
@@ -542,7 +541,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;