Merge pull request #11500 from annando/pleroma-issues

Change the featured collection to fix communication issues with Pleroma
This commit is contained in:
Tobias Diekershoff 2022-05-13 07:58:49 +02:00 committed by GitHub
commit bb44ff1528
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -334,12 +334,13 @@ 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';
$items = Post::select(['id'], $condition, ['limit' => [($page - 1) * 20, 20], 'order' => ['created' => true]]);
}
$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'];
@ -355,10 +356,11 @@ class Transmitter
$data['next'] = DI::baseUrl() . '/featured/' . $owner['nickname'] . '?page=' . ($page + 1);
}
if (!empty($page)) {
$data['partOf'] = DI::baseUrl() . '/featured/' . $owner['nickname'];
}
$data['orderedItems'] = $list;
}
return $data;
}