From 96a36568e2ebe5af5346120d616f42874fed1dff Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 30 Oct 2022 01:20:05 +0000 Subject: [PATCH] Add quote to API --- src/Factory/Api/Mastodon/Status.php | 4 +++- src/Factory/Api/Twitter/Status.php | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Factory/Api/Mastodon/Status.php b/src/Factory/Api/Mastodon/Status.php index 9ff2211907..54726815f2 100644 --- a/src/Factory/Api/Mastodon/Status.php +++ b/src/Factory/Api/Mastodon/Status.php @@ -86,7 +86,7 @@ class Status extends BaseFactory public function createFromUriId(int $uriId, int $uid = 0): \Friendica\Object\Api\Mastodon\Status { $fields = ['uri-id', 'uid', 'author-id', 'author-uri-id', 'author-link', 'starred', 'app', 'title', 'body', 'raw-body', 'content-warning', 'question-id', - 'created', 'network', 'thr-parent-id', 'parent-author-id', 'language', 'uri', 'plink', 'private', 'vid', 'gravity', 'featured', 'has-media']; + 'created', 'network', 'thr-parent-id', 'parent-author-id', 'language', 'uri', 'plink', 'private', 'vid', 'gravity', 'featured', 'has-media', 'quote-uri-id']; $item = Post::selectFirst($fields, ['uri-id' => $uriId, 'uid' => [0, $uid]], ['order' => ['uid' => true]]); if (!$item) { $mail = DBA::selectFirst('mail', ['id'], ['uri-id' => $uriId, 'uid' => $uid]); @@ -178,6 +178,8 @@ class Status extends BaseFactory $item['title'] = $reshared_item['title'] ?? $item['title']; $item['body'] = $reshared_item['body'] ?? $item['body']; } else { + $item['body'] = $this->contentItem->addSharedPost($item); + $item['raw-body'] = $this->contentItem->addSharedPost($item, $item['raw-body']); $reshare = []; } diff --git a/src/Factory/Api/Twitter/Status.php b/src/Factory/Api/Twitter/Status.php index 55f843ed28..a336c10be2 100644 --- a/src/Factory/Api/Twitter/Status.php +++ b/src/Factory/Api/Twitter/Status.php @@ -84,7 +84,7 @@ class Status extends BaseFactory { $fields = ['parent-uri-id', 'uri-id', 'uid', 'author-id', 'author-link', 'author-network', 'owner-id', 'causer-id', 'starred', 'app', 'title', 'body', 'raw-body', 'created', 'network','post-reason', 'language', 'gravity', - 'thr-parent-id', 'parent-author-id', 'parent-author-nick', 'uri', 'plink', 'private', 'vid', 'coord']; + 'thr-parent-id', 'parent-author-id', 'parent-author-nick', 'uri', 'plink', 'private', 'vid', 'coord', 'quote-uri-id']; $item = Post::selectFirst($fields, ['id' => $id], ['order' => ['uid' => true]]); if (!$item) { throw new HTTPException\NotFoundException('Item with ID ' . $id . ' not found.'); @@ -146,7 +146,7 @@ class Status extends BaseFactory $statusnetHtml = BBCode::convertForUriId($item['uri-id'], BBCode::setMentionsToNicknames($title . ($item['raw-body'] ?? $item['body'])), BBCode::API); $friendicaHtml = BBCode::convertForUriId($item['uri-id'], $title . $item['body'], BBCode::EXTERNAL); - $text .= Post\Media::addAttachmentsToBody($item['uri-id'], $item['body']); + $text .= Post\Media::addAttachmentsToBody($item['uri-id'], $this->contentItem->addSharedPost($item)); $text = trim(HTML::toPlaintext(BBCode::convertForUriId($item['uri-id'], $text, BBCode::API), 0));