From a6a79d9c7e659af6899150538306e5c7a6bd2a57 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 27 Nov 2019 21:59:11 +0000 Subject: [PATCH 1/3] Only transfer posts via mail --- src/Worker/Delivery.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Worker/Delivery.php b/src/Worker/Delivery.php index c98c60f426..97478ee18e 100644 --- a/src/Worker/Delivery.php +++ b/src/Worker/Delivery.php @@ -15,6 +15,7 @@ use Friendica\Model; use Friendica\Protocol\DFRN; use Friendica\Protocol\Diaspora; use Friendica\Protocol\Email; +use Friendica\Protocol\Activity; use Friendica\Util\Strings; use Friendica\Util\Network; use Friendica\Core\Worker; @@ -499,6 +500,10 @@ class Delivery extends BaseObject if (!in_array($cmd, [self::POST, self::POKE])) { return; } +Logger::info('Blubb', $target_item); + if ($target_item['verb'] != Activity::POST) { + return; + } if (!empty($thr_parent['object'])) { $data = json_decode($thr_parent['object'], true); From 22b89df348d3277b6c5d1867a8a6eb905e91882c Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 27 Nov 2019 22:00:43 +0000 Subject: [PATCH 2/3] Removed test logging --- src/Worker/Delivery.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Worker/Delivery.php b/src/Worker/Delivery.php index 97478ee18e..d9a2109ba3 100644 --- a/src/Worker/Delivery.php +++ b/src/Worker/Delivery.php @@ -500,7 +500,7 @@ class Delivery extends BaseObject if (!in_array($cmd, [self::POST, self::POKE])) { return; } -Logger::info('Blubb', $target_item); + if ($target_item['verb'] != Activity::POST) { return; } From 7ffd6d0bc74af167d5aa14c2befe5380b06d0143 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 28 Nov 2019 06:34:35 +0000 Subject: [PATCH 3/3] Attached photos from pixelfed are now added to the body again --- src/Protocol/ActivityPub/Processor.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php index f2b277e44e..ad1b9d8bdf 100644 --- a/src/Protocol/ActivityPub/Processor.php +++ b/src/Protocol/ActivityPub/Processor.php @@ -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;