Remove reply/like stats and per-post permalinks from thread rendering
Some checks failed
CI / test (push) Failing after 52s

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-27 11:02:23 -03:00
parent 689c4d572f
commit 5414739536

View File

@@ -250,36 +250,17 @@ final class BlueskyThreadsExtension extends Minz_Extension {
$text = $record['text'] ?? '';
$facets = $record['facets'] ?? [];
$rkey = basename(rtrim($post['uri'] ?? '', '/'));
$postUrl = 'https://bsky.app/profile/' . rawurlencode($handle) . '/post/' . $rkey;
$textHtml = nl2br($this->applyFacets($text, $facets));
$embedHtml = $embed !== null ? $this->renderEmbed($embed) : '';
$stats = '';
foreach ([
'replyCount' => 'Reply',
'repostCount' => 'Repost',
'likeCount' => 'Like',
] as $key => $label) {
if (isset($post[$key]) && (int) $post[$key] > 0) {
$n = (int) $post[$key];
$stats .= '<span style="margin-right:12px;">' . $n . ' ' . $label . ($n !== 1 ? 's' : '') . '</span>';
}
}
$rootStyle = 'border:1px solid #cfd9de;border-radius:12px;padding:12px 16px;margin-bottom:12px;';
$replyStyle = 'padding:10px 12px;margin:4px 0;';
$style = $isRoot ? $rootStyle : $replyStyle;
return <<<HTML
<div class="bsky-post" style="{$style}">
<div class="bsky-text" style="margin-bottom:8px;white-space:pre-wrap;word-break:break-word;">{$textHtml}</div>
<div class="bsky-text" style="white-space:pre-wrap;word-break:break-word;">{$textHtml}</div>
{$embedHtml}
<div style="margin-top:8px;font-size:0.8em;color:#536471;">
{$stats}
<a href="{$this->e($postUrl)}" style="color:#536471;">View on Bluesky ↗</a>
</div>
</div>
HTML;
}