fixed hiding of total in case of 0 items

This commit is contained in:
Sascha Nitsch 2025-07-20 17:34:46 +02:00
parent 9464b28e11
commit 1b92265402

View file

@ -10,7 +10,7 @@ namespace Federator\Data\ActivityPub\Common;
class Collection extends APObject class Collection extends APObject
{ {
protected int $totalItems = 0; protected int $totalItems = -1;
private string $first = ''; private string $first = '';
private string $last = ''; private string $last = '';
@ -28,7 +28,7 @@ class Collection extends APObject
{ {
$return = parent::toObject(); $return = parent::toObject();
$return['type'] = 'Collection'; $return['type'] = 'Collection';
if ($this->totalItems > 0) { if ($this->totalItems >= 0) {
$return['totalItems'] = $this->totalItems; $return['totalItems'] = $this->totalItems;
} }
if ($this->first !== '') { if ($this->first !== '') {