]> git.mxchange.org Git - friendica.git/commitdiff
Improved ID detection
authorMichael <heluecht@pirati.ca>
Sun, 20 Jan 2019 22:19:53 +0000 (22:19 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 20 Jan 2019 22:19:53 +0000 (22:19 +0000)
src/Protocol/ActivityPub/Transmitter.php

index cab00305778fecbd1d2029d5251d31c4b4f6214b..671f4279a2d21a04474830aeb854a4d59fd662ae 100644 (file)
@@ -1029,8 +1029,17 @@ class Transmitter
                        return self::createNote($item);
                }
 
-               /// @todo Better fetch the real object url.
-               return $announce['plink'];
+               // Fetch the original id of the object
+               $activity = ActivityPub::fetchContent($announce['plink'], $item['uid']);
+               if (!empty($activity)) {
+                       $ldactivity = JsonLD::compact($activity);
+                       $id = JsonLD::fetchElement($ldactivity, '@id');
+                       if (!empty($id)) {
+                               return $id;
+                       }
+               }
+
+               return self::createNote($item);
        }
 
        /**