]> git.mxchange.org Git - friendica.git/commitdiff
Allow delivery stats to be null.
authorHank Grabowski <hankgrabowski@gmail.com>
Sun, 26 Feb 2023 16:27:01 +0000 (11:27 -0500)
committerHank Grabowski <hankgrabowski@gmail.com>
Sun, 26 Feb 2023 16:27:01 +0000 (11:27 -0500)
src/Factory/Api/Mastodon/Status.php
src/Object/Api/Mastodon/Status/FriendicaDeliveryData.php

index db2f94d4953d43388a0ec173d86a13d589ef458e..fed7ea4730e372214e6642019ffdb3cc6411c2a5 100644 (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);
index 2d9b151beea96777727a77b404211bbcfd4f7044..3da0eae57c83cfa4af3725ab72b62dce1e0b34b7 100644 (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;