]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/ActivityPub/Processor.php
Some more "convertForUriId" replacements
[friendica.git] / src / Protocol / ActivityPub / Processor.php
index e36e2e7038778602adab9543cf7d013a60d67b61..f4892b6c0fb3143b2bf14d73235656b9b2a52dff 100644 (file)
@@ -21,7 +21,6 @@
 
 namespace Friendica\Protocol\ActivityPub;
 
-use Friendica\Content\PageInfo;
 use Friendica\Content\Text\BBCode;
 use Friendica\Content\Text\HTML;
 use Friendica\Content\Text\Markdown;
@@ -127,6 +126,7 @@ class Processor
                $data['url'] = $attachment['url'];
                $data['mimetype'] = $attachment['mediaType'];
                $data['height'] = $attachment['height'] ?? null;
+               $data['width'] = $attachment['width'] ?? null;
                $data['size'] = $attachment['size'] ?? null;
                $data['preview'] = $attachment['image'] ?? null;
                $data['description'] = $attachment['name'] ?? null;
@@ -464,6 +464,7 @@ class Processor
                if (!empty($activity['source'])) {
                        $item['body'] = $activity['source'];
                        $item['raw-body'] = $content;
+                       $item['body'] = Item::improveSharedDataInBody($item);
                } else {
                        if (empty($activity['directmessage']) && ($item['thr-parent'] != $item['uri']) && ($item['gravity'] == GRAVITY_COMMENT)) {
                                $item_private = !in_array(0, $activity['item_receiver']);
@@ -602,6 +603,12 @@ class Processor
                                continue;
                        }
 
+                       if (!($item['isForum'] ?? false) && ($receiver != 0) && ($item['gravity'] == GRAVITY_PARENT) &&
+                               ($item['post-reason'] == Item::PR_BCC) && !Contact::isSharingByURL($activity['author'], $receiver)) {
+                               Logger::info('Top level post via BCC from a non sharer, ignoring', ['uid' => $receiver, 'contact' => $item['contact-id']]);
+                               continue;
+                       }
+
                        if (DI::pConfig()->get($receiver, 'system', 'accept_only_sharer', false) && ($receiver != 0) && ($item['gravity'] == GRAVITY_PARENT)) {
                                $skip = !Contact::isSharingByURL($activity['author'], $receiver);
 
@@ -737,7 +744,7 @@ class Processor
                                        $title = $matches[3];
                                }
 
-                               $title = trim(HTML::toPlaintext(BBCode::convert($title, false, BBCode::API, true), 0));
+                               $title = trim(BBCode::toPlaintext($title));
 
                                if (strlen($title) > 20) {
                                        $title = substr($title, 0, 20) . '...';