Don't attach images to the body if it was from a Friendica system

This commit is contained in:
Michael 2019-05-13 19:56:46 +00:00
parent 34360ca46d
commit 9e31b1b486

View File

@ -92,10 +92,11 @@ class Processor
* *
* @param array $attachments * @param array $attachments
* @param array $item * @param array $item
* @param boolean $no_images
* *
* @return array array * @return array array
*/ */
private static function constructAttachList($attachments, $item) private static function constructAttachList($attachments, $item, $no_images)
{ {
if (empty($attachments)) { if (empty($attachments)) {
return $item; return $item;
@ -104,6 +105,10 @@ class Processor
foreach ($attachments as $attach) { foreach ($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) {
continue;
}
$item['body'] .= "\n[img]" . $attach['url'] . '[/img]'; $item['body'] .= "\n[img]" . $attach['url'] . '[/img]';
} else { } else {
if (!empty($item["attach"])) { if (!empty($item["attach"])) {
@ -351,7 +356,7 @@ class Processor
$item['plink'] = defaults($activity, 'alternate-url', $item['uri']); $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; $stored = false;