]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/ActivityPub/Receiver.php
Issue 12977: Ensure to fetch quoted posts
[friendica.git] / src / Protocol / ActivityPub / Receiver.php
index f246a9f94b13d3c316cf030ab7bd2c5d10981338..a5286761639fcdb91df0ca546a42f10f358f9198 100644 (file)
@@ -248,7 +248,7 @@ class Receiver
         * Fetches the object type for a given object id
         *
         * @param array   $activity
-        * @param string  $object_id Object ID of the the provided object
+        * @param string  $object_id Object ID of the provided object
         * @param integer $uid       User ID
         *
         * @return string with object type or NULL
@@ -630,7 +630,7 @@ class Receiver
                        $object_data['object_activity'] = $activity;
                }
 
-               if (($type == 'as:Create') && $trust_source) {
+               if (($type == 'as:Create') && $trust_source && !in_array($completion, [self::COMPLETION_MANUAL, self::COMPLETION_ANNOUNCE])) {
                        if (self::hasArrived($object_data['object_id'])) {
                                Logger::info('The activity already arrived.', ['id' => $object_data['object_id']]);
                                return true;
@@ -641,6 +641,8 @@ class Receiver
                                Logger::info('The activity is already added.', ['id' => $object_data['object_id']]);
                                return true;
                        }
+               } elseif (($type == 'as:Create') && $trust_source && !self::hasArrived($object_data['object_id'])) {
+                       self::addArrivedId($object_data['object_id']);
                }
 
                $decouple = DI::config()->get('system', 'decoupled_receiver') && !in_array($completion, [self::COMPLETION_MANUAL, self::COMPLETION_ANNOUNCE]);
@@ -1067,7 +1069,7 @@ class Receiver
        {
                $reply = $receivers = $profile = [];
 
-               // When it is an answer, we inherite the receivers from the parent
+               // When it is an answer, we inherit the receivers from the parent
                $replyto = JsonLD::fetchElement($activity, 'as:inReplyTo', '@id');
                if (!empty($replyto)) {
                        $reply = [$replyto];
@@ -1181,7 +1183,7 @@ class Receiver
                self::switchContacts($receivers, $actor);
 
                // "birdsitelive" is a service that mirrors tweets into the fediverse
-               // These posts can be fetched without authentification, but are not marked as public
+               // These posts can be fetched without authentication, but are not marked as public
                // We treat them as unlisted posts to be able to handle them.
                if (empty($receivers) && $fetch_unlisted && Contact::isPlatform($actor, 'birdsitelive')) {
                        $receivers[0]  = ['uid' => 0, 'type' => self::TARGET_GLOBAL];
@@ -1370,9 +1372,9 @@ class Receiver
        }
 
        /**
-        * Fetches the object data from external ressources if needed
+        * Fetches the object data from external resources if needed
         *
-        * @param string  $object_id    Object ID of the the provided object
+        * @param string  $object_id    Object ID of the provided object
         * @param array   $object       The provided object array
         * @param boolean $trust_source Do we trust the provided object?
         * @param integer $uid          User ID for the signature that we use to fetch data