From 9e31b1b486946c4e3dfa46d30acb6e1d8dc428d1 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 13 May 2019 19:56:46 +0000 Subject: [PATCH] Don't attach images to the body if it was from a Friendica system --- src/Protocol/ActivityPub/Processor.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php index 3bb0639ab0..53b0e7cb1d 100644 --- a/src/Protocol/ActivityPub/Processor.php +++ b/src/Protocol/ActivityPub/Processor.php @@ -90,12 +90,13 @@ class Processor /** * Add attachment data to the item array * - * @param array $attachments - * @param array $item + * @param array $attachments + * @param array $item + * @param boolean $no_images * * @return array array */ - private static function constructAttachList($attachments, $item) + private static function constructAttachList($attachments, $item, $no_images) { if (empty($attachments)) { return $item; @@ -104,6 +105,10 @@ class Processor foreach ($attachments as $attach) { $filetype = strtolower(substr($attach['mediaType'], 0, strpos($attach['mediaType'], '/'))); if ($filetype == 'image') { + if ($no_images) { + continue; + } + $item['body'] .= "\n[img]" . $attach['url'] . '[/img]'; } else { if (!empty($item["attach"])) { @@ -351,7 +356,7 @@ class Processor $item['plink'] = defaults($activity, 'alternate-url', $item['uri']); - $item = self::constructAttachList($activity['attachments'], $item); + $item = self::constructAttachList($activity['attachments'], $item, !empty($activity['source'])); $stored = false; -- 2.39.5