API: added positiv list for quote support

This commit is contained in:
Michael 2023-01-25 06:26:17 +00:00
parent a86fbe37c9
commit 49d513f8d2
23 changed files with 114 additions and 55 deletions

View file

@ -198,33 +198,6 @@ class Status extends BaseFactory
$poll = null;
}
$shared = $this->contentItem->getSharedPost($item, ['uri-id']);
if (!empty($shared)) {
$shared_uri_id = $shared['post']['uri-id'];
foreach ($this->mstdnMentionFactory->createFromUriId($shared_uri_id)->getArrayCopy() as $mention) {
if (!in_array($mention, $mentions)) {
$mentions[] = $mention;
}
}
foreach ($this->mstdnTagFactory->createFromUriId($shared_uri_id) as $tag) {
if (!in_array($tag, $tags)) {
$tags[] = $tag;
}
}
foreach ($this->mstdnAttachementFactory->createFromUriId($shared_uri_id) as $attachment) {
if (!in_array($attachment, $attachments)) {
$attachments[] = $attachment;
}
}
if (empty($card->toArray())) {
$card = $this->mstdnCardFactory->createFromUriId($shared_uri_id);
}
}
if ($display_quote) {
$quote = self::createQuote($item, $uid);
@ -239,6 +212,33 @@ class Status extends BaseFactory
$quote = self::createQuote($item, $uid);
}
$shared = $this->contentItem->getSharedPost($item, ['uri-id']);
if (!empty($shared)) {
$shared_uri_id = $shared['post']['uri-id'];
foreach ($this->mstdnMentionFactory->createFromUriId($shared_uri_id)->getArrayCopy() as $mention) {
if (!in_array($mention, $mentions)) {
$mentions[] = $mention;
}
}
foreach ($this->mstdnTagFactory->createFromUriId($shared_uri_id) as $tag) {
if (!in_array($tag, $tags)) {
$tags[] = $tag;
}
}
foreach ($this->mstdnAttachementFactory->createFromUriId($shared_uri_id) as $attachment) {
if (!in_array($attachment, $attachments)) {
$attachments[] = $attachment;
}
}
if (empty($card->toArray())) {
$card = $this->mstdnCardFactory->createFromUriId($shared_uri_id);
}
}
$item['body'] = $this->contentItem->addSharedPost($item);
if (!is_null($item['raw-body'])) {