]> git.mxchange.org Git - friendica.git/commitdiff
Attached photos from pixelfed are now added to the body again
authorMichael <heluecht@pirati.ca>
Thu, 28 Nov 2019 06:34:35 +0000 (06:34 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 28 Nov 2019 06:34:35 +0000 (06:34 +0000)
src/Protocol/ActivityPub/Processor.php

index f2b277e44ed7fa0dc681d730519392a69b57eaf6..ad1b9d8bdf10490a2f955f04b251dba834e8a3e6 100644 (file)
@@ -93,22 +93,21 @@ class Processor
        /**
         * Add attachment data to the item array
         *
-        * @param array   $attachments
+        * @param array   $activity
         * @param array   $item
-        * @param boolean $no_images
         *
         * @return array array
         */
-       private static function constructAttachList($attachments, $item, $no_images)
+       private static function constructAttachList($activity, $item)
        {
-               if (empty($attachments)) {
+               if (empty($activity['attachments'])) {
                        return $item;
                }
 
-               foreach ($attachments as $attach) {
+               foreach ($activity['attachments'] as $attach) {
                        $filetype = strtolower(substr($attach['mediaType'], 0, strpos($attach['mediaType'], '/')));
                        if ($filetype == 'image') {
-                               if ($no_images) {
+                               if (!empty($activity['source']) && strpos($activity['source'], $attach['url'])) {
                                        continue;
                                }
 
@@ -407,7 +406,7 @@ class Processor
 
                $item['plink'] = $activity['alternate-url'] ?? $item['uri'];
 
-               $item = self::constructAttachList($activity['attachments'], $item, !empty($activity['source']));
+               $item = self::constructAttachList($activity, $item);
 
                $stored = false;