]> git.mxchange.org Git - friendica.git/commitdiff
Change the featured collection to fix communication issues with Pleroma
authorMichael <heluecht@pirati.ca>
Fri, 13 May 2022 03:42:04 +0000 (03:42 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 13 May 2022 03:42:04 +0000 (03:42 +0000)
src/Protocol/ActivityPub/Transmitter.php

index e3df1a7a32fc0af404803e0ec40245faf99acce4..baaaba0680e45100177a048ea5f70e7c4aa5ddce 100644 (file)
@@ -334,32 +334,34 @@ class Transmitter
                }
 
                if (empty($page)) {
-                       $data['first'] = DI::baseUrl() . '/featured/' . $owner['nickname'] . '?page=1';
+                       $items = Post::select(['id'], $condition, ['limit' => 20, 'order' => ['created' => true]]);
                } else {
                        $data['type'] = 'OrderedCollectionPage';
-                       $list = [];
-
                        $items = Post::select(['id'], $condition, ['limit' => [($page - 1) * 20, 20], 'order' => ['created' => true]]);
-                       while ($item = Post::fetch($items)) {
-                               $activity = self::createActivityFromItem($item['id'], true);
-                               $activity['type'] = $activity['type'] == 'Update' ? 'Create' : $activity['type'];
+               }
+               $list = [];
 
-                               // Only list "Create" activity objects here, no reshares
-                               if (!empty($activity['object']) && ($activity['type'] == 'Create')) {
-                                       $list[] = $activity['object'];
-                               }
-                       }
-                       DBA::close($items);
+               while ($item = Post::fetch($items)) {
+                       $activity = self::createActivityFromItem($item['id'], true);
+                       $activity['type'] = $activity['type'] == 'Update' ? 'Create' : $activity['type'];
 
-                       if (count($list) == 20) {
-                               $data['next'] = DI::baseUrl() . '/featured/' . $owner['nickname'] . '?page=' . ($page + 1);
+                       // Only list "Create" activity objects here, no reshares
+                       if (!empty($activity['object']) && ($activity['type'] == 'Create')) {
+                               $list[] = $activity['object'];
                        }
+               }
+               DBA::close($items);
 
-                       $data['partOf'] = DI::baseUrl() . '/featured/' . $owner['nickname'];
+               if (count($list) == 20) {
+                       $data['next'] = DI::baseUrl() . '/featured/' . $owner['nickname'] . '?page=' . ($page + 1);
+               }
 
-                       $data['orderedItems'] = $list;
+               if (!empty($page)) {
+                       $data['partOf'] = DI::baseUrl() . '/featured/' . $owner['nickname'];
                }
 
+               $data['orderedItems'] = $list;
+
                return $data;
        }