Allow delivery stats to be null.

This commit is contained in:
Hank Grabowski 2023-02-26 11:27:01 -05:00
parent ea782d97fc
commit 9ab73c30ef
2 changed files with 5 additions and 5 deletions

View File

@ -288,7 +288,7 @@ class Status extends BaseFactory
$in_reply = [];
}
$delivery_data = new FriendicaDeliveryData($item['delivery_queue_count'] ?? 0, $item['delivery_queue_done'] ?? 0, $item['delivery_queue_failed'] ?? 0);
$delivery_data = new FriendicaDeliveryData($item['delivery_queue_count'], $item['delivery_queue_done'], $item['delivery_queue_failed']);
$friendica = new FriendicaExtension($item['title'], $counts->dislikes, $delivery_data);
return new \Friendica\Object\Api\Mastodon\Status($item, $account, $counts, $userAttributes, $sensitive, $application, $mentions, $tags, $card, $attachments, $in_reply, $reshare, $friendica, $quote, $poll);

View File

@ -32,13 +32,13 @@ use Friendica\BaseDataTransferObject;
*/
class FriendicaDeliveryData extends BaseDataTransferObject
{
/** @var int */
/** @var int|null */
protected $delivery_queue_count;
/** @var int */
/** @var int|null */
protected $delivery_queue_done;
/** @var int */
/** @var int|null */
protected $delivery_queue_failed;
/**
@ -46,7 +46,7 @@ class FriendicaDeliveryData extends BaseDataTransferObject
*
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public function __construct(int $delivery_queue_count, int $delivery_queue_done, int $delivery_queue_failed)
public function __construct(?int $delivery_queue_count, ?int $delivery_queue_done, ?int $delivery_queue_failed)
{
$this->delivery_queue_count = $delivery_queue_count;
$this->delivery_queue_done = $delivery_queue_done;