<?php
/**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
use Friendica\BaseDataTransferObject;
use Friendica\Content\ContactSelector;
-use Friendica\Content\Text\BBCode;
use Friendica\Model\Item;
use Friendica\Util\DateTimeFormat;
* @param array $item
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function __construct(string $text, array $item, User $author, User $owner, array $retweeted, array $quoted, array $geo, array $friendica_activities, array $entities, array $attachments, int $friendica_comments, bool $liked)
+ public function __construct(string $text, string $statusnetHtml, string $friendicaHtml, array $item, User $author, User $owner, array $retweeted, array $quoted, array $geo, array $friendica_activities, array $entities, array $attachments, int $friendica_comments, bool $liked)
{
- $this->id = (int)$item['id'];
- $this->id_str = (string)$item['id'];
- $this->statusnet_conversation_id = (int)$item['parent'];
+ $this->id = (int)$item['uri-id'];
+ $this->id_str = (string)$item['uri-id'];
+ $this->statusnet_conversation_id = (int)$item['parent-uri-id'];
$this->created_at = DateTimeFormat::utc($item['created'], DateTimeFormat::API);
- if ($item['gravity'] == GRAVITY_COMMENT) {
+ if ($item['gravity'] == Item::GRAVITY_COMMENT) {
$this->in_reply_to_status_id = (int)$item['thr-parent-id'];
$this->in_reply_to_status_id_str = (string)$item['thr-parent-id'];
$this->in_reply_to_user_id = (int)$item['parent-author-id'];
$this->text = $text;
$this->friendica_title = $item['title'];
- $this->statusnet_html = BBCode::convertForUriId($item['uri-id'], BBCode::setMentionsToNicknames($item['raw-body'] ?? $item['body']), BBCode::API);
- $this->friendica_html = BBCode::convertForUriId($item['uri-id'], $item['body'], BBCode::EXTERNAL);
- $this->user = $author->toArray();
+ $this->statusnet_html = $statusnetHtml;
+ $this->friendica_html = $friendicaHtml;
+ $this->user = $owner->toArray();
$this->friendica_author = $author->toArray();
$this->friendica_owner = $owner->toArray();
$this->truncated = false;