]> git.mxchange.org Git - friendica.git/commitdiff
AP fixes: LD-signature, wrong owner for completed thres, account removal
authorMichael <heluecht@pirati.ca>
Tue, 9 Oct 2018 05:04:24 +0000 (05:04 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 9 Oct 2018 05:04:24 +0000 (05:04 +0000)
composer.lock
src/Protocol/ActivityPub/Processor.php
src/Protocol/ActivityPub/Receiver.php
src/Worker/Notifier.php

index 7973167762cefac25b68a9886d81085b4bdb1973..9230bb4db93c59e4efc260483ba603fa2cdd2ef3 100644 (file)
         },
         {
             "name": "friendica/json-ld",
-            "version": "1.0.0",
+            "version": "1.1.1",
             "source": {
                 "type": "git",
                 "url": "https://git.friendi.ca/friendica/php-json-ld",
-                "reference": "a9ac64daf01cfd97e80c36a5104247d37c0ae5ef"
+                "reference": "ca3916d10d2ad9073b3b1eae383978dbe828e1e1"
             },
             "require": {
                 "ext-json": "*",
                 {
                     "name": "Digital Bazaar, Inc.",
                     "email": "support@digitalbazaar.com",
-                    "url": "http://digitalbazaar.com/"
+                    "homepage": "http://digitalbazaar.com/"
                 },
                 {
                     "name": "Friendica Team",
-                    "url": "https://friendi.ca/"
+                    "homepage": "https://friendi.ca/"
                 }
             ],
             "description": "A JSON-LD Processor and API implementation in PHP.",
                 "Semantic Web",
                 "jsonld"
             ],
-            "time": "2018-09-28T00:01:12+00:00"
+            "time": "2018-10-08T20:41:00+00:00"
         },
         {
             "name": "fxp/composer-asset-plugin",
index 32cfcc6cb0346f1674159b4b51b20f69ba031a84..a85123817aeb788ad6d65dcd9fb99c606912a36a 100644 (file)
@@ -18,6 +18,9 @@ use Friendica\Protocol\ActivityPub;
 
 /**
  * ActivityPub Protocol class
+ *
+ * To-Do:
+ * - Store Diaspora signature
  */
 class Processor
 {
@@ -194,7 +197,14 @@ class Processor
                $item['network'] = Protocol::ACTIVITYPUB;
                $item['private'] = !in_array(0, $activity['receiver']);
                $item['author-id'] = Contact::getIdForURL($activity['author'], 0, true);
-               $item['owner-id'] = Contact::getIdForURL($activity['actor'], 0, true);
+
+               if (empty($activity['thread-completion'])) {
+                       $item['owner-id'] = Contact::getIdForURL($activity['actor'], 0, true);
+               } else {
+                       logger('Ignoring actor because of thread completion.', LOGGER_DEBUG);
+                       $item['owner-id'] = $item['author-id'];
+               }
+
                $item['uri'] = $activity['id'];
                $item['created'] = $activity['published'];
                $item['edited'] = $activity['updated'];
@@ -261,6 +271,9 @@ class Processor
                $activity['type'] = 'Create';
 
                $ldactivity = JsonLD::compact($activity);
+
+               $ldactivity['thread-completion'] = true;
+
                ActivityPub\Receiver::processActivity($ldactivity);
                logger('Activity ' . $url . ' had been fetched and processed.');
        }
index 1dac0bb827f0619c723824e9e002e70d8c0a07bc..f371eede7fe4b048f611447b0b2a98bbea53df9e 100644 (file)
@@ -268,6 +268,11 @@ class Receiver
                        return;
                }
 
+               // Internal flag for thread completion. See Processor.php
+               if (!empty($activity['thread-completion'])) {
+                       $object_data['thread-completion'] = $activity['thread-completion'];
+               }
+
                switch ($type) {
                        case 'as:Create':
                        case 'as:Announce':
index b57c81db7729a124072c53f9958ff8ac6490096f..6bfd2bc3b3f9aabe8368c22f5e5a04feba564306 100644 (file)
@@ -103,9 +103,9 @@ class Notifier
 
                        $inboxes = ActivityPub\Transmitter::fetchTargetInboxesforUser(0);
                        foreach ($inboxes as $inbox) {
-                               logger('Account removal for user ' . $uid . ' to ' . $inbox .' via ActivityPub', LOGGER_DEBUG);
+                               logger('Account removal for user ' . $item_id . ' to ' . $inbox .' via ActivityPub', LOGGER_DEBUG);
                                Worker::add(['priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true],
-                                       'APDelivery', Delivery::REMOVAL, '', $inbox, $uid);
+                                       'APDelivery', Delivery::REMOVAL, '', $inbox, $item_id);
                        }
 
                        return;