From: Michael Date: Sat, 5 Nov 2022 16:25:04 +0000 (+0000) Subject: Transmit the quoted part in the source X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4dd2d7ebab91ebbda9ce4723650b5b639fbf0a32;p=friendica.git Transmit the quoted part in the source --- diff --git a/src/Content/Item.php b/src/Content/Item.php index c867582b94..1b787ca4d7 100644 --- a/src/Content/Item.php +++ b/src/Content/Item.php @@ -597,7 +597,7 @@ class Item return $body; } - return $body . "\n" . $this->createSharedBlockByArray($shared_item, true); + return BBCode::removeSharedData($body) . "\n" . $this->createSharedBlockByArray($shared_item, true); } /** @@ -748,6 +748,8 @@ class Item return $body; } + $body = BBCode::removeSharedData($body); + $body .= "\n♲ " . ($post['plink'] ?: $post['uri']); return $body; diff --git a/src/Model/Item.php b/src/Model/Item.php index 73bd583a7f..cf7300fc34 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -220,10 +220,7 @@ class Item $content_fields['raw-body'] = Post\Media::insertFromBody($item['uri-id'], $content_fields['raw-body']); $content_fields['raw-body'] = self::setHashtags($content_fields['raw-body']); - if ($item['author-network'] != Protocol::DFRN) { - Post\Media::insertFromRelevantUrl($item['uri-id'], $content_fields['raw-body']); - } - + Post\Media::insertFromRelevantUrl($item['uri-id'], $content_fields['raw-body']); Post\Content::update($item['uri-id'], $content_fields); } @@ -1148,9 +1145,7 @@ class Item $item['raw-body'] = Post\Media::insertFromBody($item['uri-id'], $item['raw-body']); $item['raw-body'] = self::setHashtags($item['raw-body']); - if (!DBA::exists('contact', ['id' => $item['author-id'], 'network' => Protocol::DFRN])) { - Post\Media::insertFromRelevantUrl($item['uri-id'], $item['raw-body']); - } + Post\Media::insertFromRelevantUrl($item['uri-id'], $item['raw-body']); // Check for hashtags in the body and repair or add hashtag links $item['body'] = self::setHashtags($item['body']); diff --git a/src/Protocol/ActivityPub/Transmitter.php b/src/Protocol/ActivityPub/Transmitter.php index 6a601b6f98..95bb0f3121 100644 --- a/src/Protocol/ActivityPub/Transmitter.php +++ b/src/Protocol/ActivityPub/Transmitter.php @@ -1667,7 +1667,6 @@ class Transmitter $body = BBCode::setMentionsToNicknames($body); if (!empty($item['quote-uri-id'])) { - $body = BBCode::removeSharedData($body); if (Post::exists(['uri-id' => $item['quote-uri-id'], 'network' => [Protocol::ACTIVITYPUB, Protocol::DFRN]])) { $real_quote = true; $data['quoteUrl'] = $item['quote-uri']; @@ -1687,7 +1686,6 @@ class Transmitter if (!empty($language)) { $richbody = BBCode::setMentionsToNicknames($item['body'] ?? ''); if (!empty($item['quote-uri-id'])) { - $richbody = BBCode::removeSharedData($richbody); if ($real_quote) { $richbody = DI::contentItem()->addShareLink($richbody, $item['quote-uri-id']); } else { @@ -1699,7 +1697,13 @@ class Transmitter $data['contentMap'][$language] = BBCode::convertForUriId($item['uri-id'], $richbody, BBCode::EXTERNAL); } - $data['source'] = ['content' => $item['body'], 'mediaType' => "text/bbcode"]; + if (!empty($item['quote-uri-id'])) { + $source = DI::contentItem()->addSharedPost($item, $item['body']); + } else { + $source = $item['body']; + } + + $data['source'] = ['content' => $source, 'mediaType' => "text/bbcode"]; if (!empty($item['signed_text']) && ($item['uri'] != $item['thr-parent'])) { $data['diaspora:comment'] = $item['signed_text'];