Merge pull request #12855 from HankG/fix-use-mastodon-edited-at-field
Use Mastodon standard edited_at field for tracking edit time
This commit is contained in:
commit
e8492954a2
4 changed files with 16 additions and 18 deletions
|
@ -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['changed'], $item['commented'], $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);
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue