Merge pull request #7875 from annando/fix-pixelfed

Attached photos from pixelfed are now added to the body again
This commit is contained in:
Tobias Diekershoff 2019-11-28 16:25:56 +01:00 committed by GitHub
commit 5dce62e477
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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