]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/ActivityPub/Receiver.php
Merge branch 'post-reason' of github.com:annando/friendica into post-reason
[friendica.git] / src / Protocol / ActivityPub / Receiver.php
index af6eca61e8ff6a0041fdbbd872dd1d00bc327bf7..2231d0acbd3f8e673746f0097111b9a53c2eb45a 100644 (file)
@@ -241,7 +241,7 @@ class Receiver
                        return 'as:' . $profile['type'];
                }
 
-               $data = ActivityPub::fetchContent($object_id, $uid);
+               $data = Processor::fetchCachedActivity($object_id, $uid);
                if (!empty($data)) {
                        $object = JsonLD::compact($data);
                        $type = JsonLD::fetchElement($object, '@type');
@@ -284,7 +284,7 @@ class Receiver
                if (!empty($id) && !$trust_source) {
                        $fetch_uid = $uid ?: self::getBestUserForActivity($activity);
 
-                       $fetched_activity = ActivityPub::fetchContent($fetch_id, $fetch_uid);
+                       $fetched_activity = Processor::fetchCachedActivity($fetch_id, $fetch_uid);
                        if (!empty($fetched_activity)) {
                                $object = JsonLD::compact($fetched_activity);
 
@@ -358,7 +358,7 @@ class Receiver
 
                // Fetch the activity on Lemmy "Announce" messages (announces of activities)
                if (($type == 'as:Announce') && in_array($object_type, array_merge(self::ACTIVITY_TYPES, ['as:Delete', 'as:Undo', 'as:Update']))) {
-                       $data = ActivityPub::fetchContent($object_id, $fetch_uid);
+                       $data = Processor::fetchCachedActivity($object_id, $fetch_uid);
                        if (!empty($data)) {
                                $type = $object_type;
                                $activity = JsonLD::compact($data);
@@ -592,7 +592,7 @@ class Receiver
                        return;
                }
 
-               if (!empty($object_data['entry-id']) && ($push || ($activity['completion-mode'] == self::COMPLETION_RELAY))) {
+               if (!empty($object_data['entry-id']) && DI::config()->get('system', 'decoupled_receiver') && ($push || ($activity['completion-mode'] == self::COMPLETION_RELAY))) {
                        // We delay by 5 seconds to allow to accumulate all receivers
                        $delayed = date(DateTimeFormat::MYSQL, time() + 5);
                        Logger::debug('Initiate processing', ['id' => $object_data['entry-id'], 'uri' => $object_data['object_id']]);
@@ -986,7 +986,7 @@ class Receiver
                }
 
                if (!empty($reply)) {
-                       $parents = Post::select(['uid'], ['uri' => $reply]);
+                       $parents = Post::select(['uid'], DBA::mergeConditions(['uri' => $reply], ["`uid` != ?", 0]));
                        while ($parent = Post::fetch($parents)) {
                                $receivers[$parent['uid']] = ['uid' => $parent['uid'], 'type' => self::TARGET_ANSWER];
                        }
@@ -1273,7 +1273,7 @@ class Receiver
                $type = JsonLD::fetchElement($object, '@type');
 
                if (!$trust_source || empty($type)) {
-                       $data = ActivityPub::fetchContent($object_id, $uid);
+                       $data = Processor::fetchCachedActivity($object_id, $uid);
                        if (!empty($data)) {
                                $object = JsonLD::compact($data);
                                Logger::info('Fetched content for ' . $object_id);