]> git.mxchange.org Git - friendica.git/commitdiff
Fix notices because of unknown Hubzilla activity type
authorMichael <heluecht@pirati.ca>
Fri, 9 Jul 2021 19:30:41 +0000 (19:30 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 9 Jul 2021 19:30:41 +0000 (19:30 +0000)
src/Protocol/ActivityPub/Processor.php
src/Protocol/ActivityPub/Receiver.php

index ef4e1097642ef3a6a8bf75547322d8ec27b22eb3..fa04dc73479c40b115665dbf40813689e54e5c84 100644 (file)
@@ -192,10 +192,6 @@ class Processor
         */
        public static function createItem($activity)
        {
-               if (empty($activity['reply-to-id'])) {
-                       $activity['reply-to-id'] = $activity['id'];
-               }
-
                $item = [];
                $item['verb'] = Activity::POST;
                $item['thr-parent'] = $activity['reply-to-id'];
index 7c753f18860f43a94e2b92186dfbdab8d2a213c8..277c93cd766bc67dede543d5e497d556979f5d61 100644 (file)
@@ -333,7 +333,8 @@ class Receiver
                $object_type = self::fetchObjectType($activity, $object_id, $uid);
 
                // Fetch the content only on activities where this matters
-               if (in_array($type, ['as:Create', 'as:Update', 'as:Announce'])) {
+               // We can receive "#emojiReaction" when fetching content from Hubzilla systems
+               if (in_array($type, ['as:Create', 'as:Update', 'as:Announce']) || strpos($type, '#emojiReaction')) {
                        // Always fetch on "Announce"
                        $object_data = self::fetchObject($object_id, $activity['as:object'], $trust_source && ($type != 'as:Announce'), $uid);
                        if (empty($object_data)) {
@@ -501,7 +502,7 @@ class Receiver
                if (!empty($activity['from-relay'])) {
                        $object_data['from-relay'] = $activity['from-relay'];
                }
-               
+
                switch ($type) {
                        case 'as:Create':
                                if (in_array($object_data['object_type'], self::CONTENT_TYPES)) {
@@ -627,7 +628,7 @@ class Receiver
         * @param array   $activity
         * @param string  $actor
         * @param array   $tags
-        * @param boolean $fetch_unlisted 
+        * @param boolean $fetch_unlisted
         *
         * @return array with receivers (user id)
         * @throws \Exception
@@ -687,7 +688,7 @@ class Receiver
                                        $receivers[0] = ['uid' => 0, 'type' => self::TARGET_GLOBAL];
                                }
 
-                               // Add receiver "-1" for unlisted posts 
+                               // Add receiver "-1" for unlisted posts
                                if ($fetch_unlisted && ($receiver == self::PUBLIC_COLLECTION) && ($element == 'as:cc')) {
                                        $receivers[-1] = ['uid' => -1, 'type' => self::TARGET_GLOBAL];
                                }
@@ -950,7 +951,7 @@ class Receiver
                                Logger::info('Empty id');
                                return false;
                        }
-       
+
                        if ($id != $object_id) {
                                Logger::info('Fetched id differs from provided id', ['provided' => $object_id, 'fetched' => $id]);
                                return false;
@@ -1232,7 +1233,7 @@ class Receiver
                if (empty($object['as:url'])) {
                        return $object_data;
                }
-               
+
                $urls = $object['as:url'];
                $keys = array_keys($urls);
                if (!is_numeric(array_pop($keys))) {
@@ -1299,7 +1300,7 @@ class Receiver
         * @return array
         * @throws \Exception
         */
-       private static function processObject($object)
+       public static function processObject($object)
        {
                if (!JsonLD::fetchElement($object, '@id')) {
                        return false;