Only add the media for non federated posts

This commit is contained in:
Michael 2022-10-12 05:34:55 +00:00
parent 0e82f64d71
commit e69b04d2df

View File

@ -657,7 +657,9 @@ class Item
public function createSharedBlockByArray(array $item): string public function createSharedBlockByArray(array $item): string
{ {
if (!in_array($item['network'] ?? '', Protocol::FEDERATED)) { if (!in_array($item['network'] ?? '', Protocol::FEDERATED)) {
$item['guid'] = '';
$item['uri'] = ''; $item['uri'] = '';
$item['body'] = Post\Media::addAttachmentsToBody($item['uri-id'], $item['body']);
} }
$shared_content = BBCode::getShareOpeningTag($item['author-name'], $item['author-link'], $item['author-avatar'], $item['plink'], $item['created'], $item['guid'], $item['uri']); $shared_content = BBCode::getShareOpeningTag($item['author-name'], $item['author-link'], $item['author-avatar'], $item['plink'], $item['created'], $item['guid'], $item['uri']);
@ -668,8 +670,6 @@ class Item
$shared = BBCode::fetchShareAttributes($item['body']); $shared = BBCode::fetchShareAttributes($item['body']);
$item['body'] = Post\Media::addAttachmentsToBody($item['uri-id'], $item['body'], [Post\Media::IMAGE]);
// If it is a reshared post then reformat it to avoid display problems with two share elements // If it is a reshared post then reformat it to avoid display problems with two share elements
if (Diaspora::isReshare($item['body'], false)) { if (Diaspora::isReshare($item['body'], false)) {
if (!empty($shared['guid']) && ($encaspulated_share = self::createSharedPostByGuid($shared['guid']))) { if (!empty($shared['guid']) && ($encaspulated_share = self::createSharedPostByGuid($shared['guid']))) {