]> git.mxchange.org Git - friendica.git/commitdiff
Use Mastodon standard edited_at field for tracking edit time
authorHank Grabowski <hankgrabowski@gmail.com>
Tue, 28 Feb 2023 20:02:02 +0000 (15:02 -0500)
committerHank Grabowski <hankgrabowski@gmail.com>
Tue, 28 Feb 2023 20:02:02 +0000 (15:02 -0500)
src/Factory/Api/Mastodon/Status.php
src/Module/BaseApi.php
src/Object/Api/Mastodon/Status.php
src/Object/Api/Mastodon/Status/FriendicaExtension.php

index 642c9efe833fa164c3dbf49fa03e9b0fded8ecd1..9c1bce02689596f2cdfa1c73eaf54622e93e879a 100644 (file)
@@ -289,7 +289,7 @@ class Status extends BaseFactory
                }
 
                $delivery_data = new FriendicaDeliveryData($item['delivery_queue_count'], $item['delivery_queue_done'], $item['delivery_queue_failed']);
-               $friendica     = new FriendicaExtension($item['title'], $item['changed'], $item['commented'], $item['edited'], $item['received'], $counts->dislikes, $delivery_data);
+               $friendica     = new FriendicaExtension($item['title'], $item['commented'], $item['edited'], $item['received'], $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);
        }
@@ -355,7 +355,7 @@ class Status extends BaseFactory
                $attachments = [];
                $in_reply    = [];
                $reshare     = [];
-               $friendica   = new FriendicaExtension('', null, null, null, null, 0, new FriendicaDeliveryData(0, 0, 0));
+               $friendica   = new FriendicaExtension('', null, null, null, 0, new FriendicaDeliveryData(0, 0, 0));
 
                return new \Friendica\Object\Api\Mastodon\Status($item, $account, $counts, $userAttributes, $sensitive, $application, $mentions, $tags, $card, $attachments, $in_reply, $reshare, $friendica);
        }
index 10e64044f31a987141d04b188d9d6168900262b8..b5fc8c8499254b97e74f2ab670cc8a6b984be71a 100644 (file)
@@ -221,8 +221,8 @@ class BaseApi extends BaseModule
                                        }
                                        break;
                                case TimelineOrderByTypes::EDITED:
-                                       if (!empty($status->friendicaExtension()->editedAt())) {
-                                               self::setBoundaries(new DateTime(DateTimeFormat::utc($status->friendicaExtension()->editedAt(), DateTimeFormat::JSON)));
+                                       if (!empty($status->editedAt())) {
+                                               self::setBoundaries(new DateTime(DateTimeFormat::utc($status->editedAt(), DateTimeFormat::JSON)));
                                        }
                                        break;
                                case TimelineOrderByTypes::RECEIVED:
index 5563981f13d63a407f4ec559ab05afa2a1677fd7..1ce996c5d8e4e330cbe127e6f81b67ccd44ca26d 100644 (file)
@@ -40,6 +40,8 @@ class Status extends BaseDataTransferObject
        protected $id;
        /** @var string|null (Datetime) */
        protected $created_at;
+       /** @var string|null (Datetime) */
+       protected $edited_at;
        /** @var string|null */
        protected $in_reply_to_id = null;
        /** @var Status|null - Fedilab extension, see issue https://github.com/friendica/friendica/issues/12672 */
@@ -109,6 +111,7 @@ class Status extends BaseDataTransferObject
        {
                $this->id           = (string)$item['uri-id'];
                $this->created_at   = $item['created'];
+               $this->edited_at    = $item['edited'];
 
                if ($item['gravity'] == Item::GRAVITY_COMMENT) {
                        $this->in_reply_to_id         = (string)$item['thr-parent-id'];
@@ -163,6 +166,15 @@ class Status extends BaseDataTransferObject
                return $this->created_at;
        }
 
+       /**
+        * Returns the current edited_at string or null if not set
+        * @return ?string
+        */
+       public function editedAt(): ?string
+       {
+               return $this->edited_at;
+       }
+
        /**
         * Returns the Friendica Extension properties
         * @return FriendicaExtension
index b6dcd5df0c34109acaa44e5865f740bcbd702455..8e68f3014eddfbbbf45496ac28f3e2553b56bf3a 100644 (file)
@@ -41,9 +41,6 @@ class FriendicaExtension extends BaseDataTransferObject
        /** @var string|null (Datetime) */
        protected $commented_at;
 
-       /** @var string|null (Datetime) */
-       protected $edited_at;
-
        /** @var string|null (Datetime) */
        protected $received_at;
 
@@ -68,7 +65,6 @@ class FriendicaExtension extends BaseDataTransferObject
                string $title,
                ?string $changed_at,
                ?string $commented_at,
-               ?string $edited_at,
                ?string $received_at,
                int $dislikes_count,
                FriendicaDeliveryData $delivery_data
@@ -76,7 +72,6 @@ class FriendicaExtension extends BaseDataTransferObject
                $this->title          = $title;
                $this->changed_at     = $changed_at;
                $this->commented_at   = $commented_at;
-               $this->edited_at      = $edited_at;
                $this->received_at    = $received_at;
                $this->delivery_data  = $delivery_data;
                $this->dislikes_count = $dislikes_count;
@@ -100,15 +95,6 @@ class FriendicaExtension extends BaseDataTransferObject
                return $this->commented_at;
        }
 
-       /**
-        * Returns the current edited_at string or null if not set
-        * @return ?string
-        */
-       public function editedAt(): ?string
-       {
-               return $this->edited_at;
-       }
-
        /**
         * Returns the current received_at string or null if not set
         * @return ?string