From 68d6e11d831cc3092e7011b90be36fa28fd0cbab Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 11 Oct 2022 20:10:39 +0000 Subject: [PATCH] Fix attached media in quoted posts --- src/Content/Item.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Content/Item.php b/src/Content/Item.php index 539814655..7a86135f9 100644 --- a/src/Content/Item.php +++ b/src/Content/Item.php @@ -666,8 +666,19 @@ class Item $shared_content .= '[h3]' . $item['title'] . "[/h3]\n"; } + $shared = BBCode::fetchShareAttributes($item['body']); + + $item['body'] = Post\Media::addAttachmentsToBody($item['uri-id'], $item['body']); + // If it is a reshared post then reformat it to avoid display problems with two share elements if (Diaspora::isReshare($item['body'], false)) { + if (!empty($shared['guid'])) { + $encaspulated_share = self::createSharedPostByGuid($shared['guid']); + if (!empty($encaspulated_share)) { + $item['body'] = preg_replace("/\[share.*?\](.*)\[\/share\]/ism", $encaspulated_share, $item['body']); + } + } + $item['body'] = HTML::toBBCode(BBCode::convertForUriId($item['uri-id'], $item['body'], BBCode::ACTIVITYPUB)); }