]> git.mxchange.org Git - friendica.git/commitdiff
Transmit the quoted part in the source
authorMichael <heluecht@pirati.ca>
Sat, 5 Nov 2022 16:25:04 +0000 (16:25 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 5 Nov 2022 16:25:04 +0000 (16:25 +0000)
src/Content/Item.php
src/Model/Item.php
src/Protocol/ActivityPub/Transmitter.php

index c867582b94697ad3756dadb6e0250b428ed38074..1b787ca4d75ffd80d5387e3b5fde60773747cada 100644 (file)
@@ -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;
index 73bd583a7f3361501328a52e02b80fd53b93e106..cf7300fc345202e53f6939110f7a1871864575db 100644 (file)
@@ -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']);
index 6a601b6f98636e2791dfbb67414f2ffb3977a20b..95bb0f3121fc6b53538655fdb596e7e52945c83e 100644 (file)
@@ -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'];