]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/ActivityPub/Receiver.php
The quote functionality is simplified
[friendica.git] / src / Protocol / ActivityPub / Receiver.php
index a410c352589830e483d2bb45349c58926c82a025..30348c7adeb1142feba3bac60394634b8a7441f1 100644 (file)
@@ -512,7 +512,10 @@ class Receiver
 //                     }
 //             }
 
-               Logger::info('Processing ' . $object_data['type'] . ' ' . $object_data['object_type'] . ' ' . $object_data['id']);
+               $account = Contact::selectFirstAccount(['platform'], ['nurl' => Strings::normaliseLink($actor)]);
+               $platform = $account['platform'] ?? '';
+
+               Logger::info('Processing', ['type' => $object_data['type'], 'object_type' => $object_data['object_type'], 'id' => $object_data['id'], 'actor' => $actor, 'platform' => $platform]);
 
                return $object_data;
        }
@@ -887,13 +890,13 @@ class Receiver
                                } elseif (($object_data['object_type'] == 'as:Block') &&
                                        in_array($object_data['object_object_type'], self::ACCOUNT_TYPES)) {
                                        ActivityPub\Processor::unblockAccount($object_data);
-                               } elseif (in_array($object_data['object_type'], array_merge(self::ACTIVITY_TYPES, ['as:Announce'])) &&
-                                       in_array($object_data['object_object_type'], array_merge(['as:Tombstone'], self::CONTENT_TYPES))) {
-                                       ActivityPub\Processor::undoActivity($object_data);
                                } elseif (in_array($object_data['object_type'], array_merge(self::ACTIVITY_TYPES, ['as:Announce', 'as:Create', ''])) &&
                                        empty($object_data['object_object_type'])) {
                                        // We cannot detect the target object. So we can ignore it.
                                        Queue::remove($object_data);
+                               } elseif (in_array($object_data['object_type'], array_merge(self::ACTIVITY_TYPES, ['as:Announce'])) &&
+                                       in_array($object_data['object_object_type'], array_merge(['as:Tombstone'], self::CONTENT_TYPES))) {
+                                       ActivityPub\Processor::undoActivity($object_data);
                                } elseif (in_array($object_data['object_type'], ['as:Create']) &&
                                        in_array($object_data['object_object_type'], ['pt:CacheFile'])) {
                                        // Unhandled Peertube activity
@@ -1148,6 +1151,17 @@ 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
+               // 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];
+                       $receivers[-1] = ['uid' => -1, 'type' => self::TARGET_GLOBAL];
+                       Logger::notice('Post from "birdsitelive" is set to "unlisted"', ['id' => JsonLD::fetchElement($activity, '@id')]);
+               } elseif (empty($receivers)) {
+                       Logger::notice('Post has got no receivers', ['fetch_unlisted' => $fetch_unlisted, 'actor' => $actor, 'id' => JsonLD::fetchElement($activity, '@id'), 'type' => JsonLD::fetchElement($activity, '@type')]);
+               }
+
                return $receivers;
        }