]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/ActivityPub/Transmitter.php
Improved defaults check
[friendica.git] / src / Protocol / ActivityPub / Transmitter.php
index 44b0463b033b4e73e799937ddd6d617cb77bb356..0b7159ec909275b5043f1af3cd0892079fa91a2a 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -437,6 +437,13 @@ class Transmitter
                        return [];
                }
 
+               $permissions = [
+                       'to' => [],
+                       'cc' => [],
+                       'bto' => [],
+                       'bcc' => [],
+               ];
+
                $activity = json_decode($conversation['source'], true);
 
                $actor = JsonLD::fetchElement($activity, 'actor', 'id');
@@ -1286,7 +1293,7 @@ class Transmitter
 
                $urls = [];
                foreach ($uriids as $uriid) {
-                       foreach (Post\Media::getByURIId($uriid, [Post\Media::DOCUMENT, Post\Media::TORRENT]) as $attachment) {
+                       foreach (Post\Media::getByURIId($uriid, [Post\Media::AUDIO, Post\Media::IMAGE, Post\Media::VIDEO, Post\Media::DOCUMENT, Post\Media::TORRENT]) as $attachment) {
                                if (in_array($attachment['url'], $urls)) {
                                        continue;
                                }
@@ -1313,52 +1320,6 @@ class Transmitter
                        }
                }
 
-               if ($type != 'Note') {
-                       return $attachments;
-               }
-
-               foreach ($uriids as $uriid) {
-                       foreach (Post\Media::getByURIId($uriid, [Post\Media::AUDIO, Post\Media::IMAGE, Post\Media::VIDEO]) as $attachment) {
-                               if (in_array($attachment['url'], $urls)) {
-                                       continue;
-                               }
-                               $urls[] = $attachment['url'];
-
-                               $attach = ['type' => 'Document',
-                                       'mediaType' => $attachment['mimetype'],
-                                       'url' => $attachment['url'],
-                                       'name' => $attachment['description']];
-
-                               if (!empty($attachment['height'])) {
-                                       $attach['height'] = $attachment['height'];
-                               }
-
-                               if (!empty($attachment['width'])) {
-                                       $attach['width'] = $attachment['width'];
-                               }
-
-                               if (!empty($attachment['preview'])) {
-                                       $attach['image'] = $attachment['preview'];
-                               }
-
-                               $attachments[] = $attach;
-                       }
-                       // Currently deactivated, since it creates side effects on Mastodon and Pleroma.
-                       // It will be activated, once this cleared.
-                       /*
-                       foreach (Post\Media::getByURIId($uriid, [Post\Media::HTML]) as $attachment) {
-                               if (in_array($attachment['url'], $urls)) {
-                                       continue;
-                               }
-                               $urls[] = $attachment['url'];
-
-                               $attachments[] = ['type' => 'Page',
-                                       'mediaType' => $attachment['mimetype'],
-                                       'url' => $attachment['url'],
-                                       'name' => $attachment['description']];
-                       }*/
-               }
-
                return $attachments;
        }