]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/ActivityPub.php
We now use the conversation data with AP
[friendica.git] / src / Protocol / ActivityPub.php
index 5b5d16e85a9c3813ab33e8a3047a2364253508c4..9fb22b2bd9e18a3c4af93ec0b435a4cfbd6bc46c 100644 (file)
@@ -32,6 +32,7 @@ use Friendica\Network\Probe;
  *
  * Digest: https://tools.ietf.org/html/rfc5843
  * https://tools.ietf.org/html/draft-cavage-http-signatures-10#ref-15
+ * https://github.com/digitalbazaar/php-json-ld
  *
  * Part of the code for HTTP signing is taken from the Osada project.
  * https://framagit.org/macgirvin/osada
@@ -156,6 +157,19 @@ class ActivityPub
        {
                $item = Item::selectFirst([], ['id' => $item_id]);
 
+               if (!DBA::isResult($item)) {
+                       return false;
+               }
+
+               $condition = ['item-uri' => $item['uri'], 'protocol' => Conversation::PARCEL_ACTIVITYPUB];
+               $conversation = DBA::selectFirst('conversation', ['source'], $condition);
+               if (DBA::isResult($conversation)) {
+                       $data = json_decode($conversation['source']);
+                       if (!empty($data)) {
+                               return $data;
+                       }
+               }
+
                $data = ['@context' => ['https://www.w3.org/ns/activitystreams', 'https://w3id.org/security/v1',
                        ['Emoji' => 'toot:Emoji', 'Hashtag' => 'as:Hashtag', 'atomUri' => 'ostatus:atomUri',
                        'conversation' => 'ostatus:conversation', 'inReplyToAtomUri' => 'ostatus:inReplyToAtomUri',
@@ -1029,6 +1043,11 @@ class ActivityPub
                                        $tag_text .= ',';
                                }
 
+                               if (empty($tag['href'])) {
+                                       //$tag['href']
+                                       logger('Blubb!');
+                               }
+
                                $tag_text .= substr($tag['name'], 0, 1) . '[url=' . $tag['href'] . ']' . substr($tag['name'], 1) . '[/url]';
                        }
                }