Improve display of quoted posts

This commit is contained in:
Michael 2023-07-09 14:15:01 +00:00
parent fba4a70dc2
commit e95c678141
3 changed files with 14 additions and 4 deletions

View file

@ -677,7 +677,6 @@ class Item
if ($item['network'] == Protocol::FEED) {
return PageInfo::getFooterFromUrl($item['plink']);
} elseif (!in_array($item['network'] ?? '', Protocol::FEDERATED)) {
$item['guid'] = '';
$item['uri'] = '';
}
@ -695,7 +694,7 @@ class Item
// If it is a reshared post then reformat it to avoid display problems with two share elements
if (!empty($shared)) {
if (!empty($shared['guid']) && ($encapsulated_share = $this->createSharedPostByGuid($shared['guid'], true))) {
if (($item['network'] != Protocol::BLUESKY) && !empty($shared['guid']) && ($encapsulated_share = $this->createSharedPostByGuid($shared['guid'], true))) {
if (!empty(BBCode::fetchShareAttributes($item['body']))) {
$item['body'] = preg_replace("/\[share.*?\](.*)\[\/share\]/ism", $encapsulated_share, $item['body']);
} else {

View file

@ -64,7 +64,8 @@ class BBCode
const ACTIVITYPUB = 9;
const BLUESKY = 10;
const TOP_ANCHOR = '<br class="top-anchor">';
const SHARED_ANCHOR = '<hr class="shared-anchor">';
const TOP_ANCHOR = '<br class="top-anchor">';
const BOTTOM_ANCHOR = '<br class="button-anchor">';
const PREVIEW_NONE = 0;
@ -930,7 +931,7 @@ class BBCode
$network = $contact['network'] ?? Protocol::PHANTOM;
$tpl = Renderer::getMarkupTemplate('shared_content.tpl');
$text .= Renderer::replaceMacros($tpl, [
$text .= BBCode::SHARED_ANCHOR . Renderer::replaceMacros($tpl, [
'$profile' => $attributes['profile'],
'$avatar' => $attributes['avatar'],
'$author' => $attributes['author'],