]> git.mxchange.org Git - friendica.git/commitdiff
Fix for AP posts where the URL don't match
authorMichael <heluecht@pirati.ca>
Mon, 20 Jan 2020 22:30:34 +0000 (22:30 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 20 Jan 2020 22:30:34 +0000 (22:30 +0000)
src/Model/Item.php
src/Protocol/ActivityPub/Processor.php

index 9f2f45e74a28eb2cdaebe8a4300c39e9d7b7d6fe..41c6eeb94dba76d4adc8f03c5640d50697da7184 100644 (file)
@@ -3742,8 +3742,8 @@ class Item
                        return $item_id;
                }
 
-               if (ActivityPub\Processor::fetchMissingActivity($uri)) {
-                       $item_id = self::searchByLink($uri, $uid);
+               if ($fetched_uri = ActivityPub\Processor::fetchMissingActivity($uri)) {
+                       $item_id = self::searchByLink($fetched_uri, $uid);
                } else {
                        $item_id = Diaspora::fetchByURL($uri);
                }
index 0d6991c07262d8e6500cf0422a1411acdf4148d1..9267943d5eb8c9218c4f96509854a844570d8e88 100644 (file)
@@ -591,7 +591,7 @@ class Processor
         *
         * @param string $url message URL
         * @param array $child activity array with the child of this message
-        * @return boolean success
+        * @return string fetched message URL
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
        public static function fetchMissingActivity($url, $child = [])
@@ -605,12 +605,12 @@ class Processor
                $object = ActivityPub::fetchContent($url, $uid);
                if (empty($object)) {
                        Logger::log('Activity ' . $url . ' was not fetchable, aborting.');
-                       return false;
+                       return '';
                }
 
                if (empty($object['id'])) {
                        Logger::log('Activity ' . $url . ' has got not id, aborting. ' . json_encode($object));
-                       return false;
+                       return '';
                }
 
                if (!empty($child['author'])) {
@@ -648,9 +648,9 @@ class Processor
                $ldactivity['thread-completion'] = true;
 
                ActivityPub\Receiver::processActivity($ldactivity);
-               Logger::log('Activity ' . $url . ' had been fetched and processed.');
+               Logger::notice('Activity had been fetched and processed.', ['url' => $url, 'object' => $activity['id']]);
 
-               return true;
+               return $activity['id'];
        }
 
        /**