Compare commits
2 Commits
59ca1999e6
...
13f7f12499
| Author | SHA1 | Date | |
|---|---|---|---|
|
13f7f12499
|
|||
|
bf72b74a01
|
@@ -241,7 +241,7 @@ final class BlueskyThreadsExtension extends Minz_Extension {
|
|||||||
$repliesHtml .= $this->renderThread($reply, false, $rootAuthorDid);
|
$repliesHtml .= $this->renderThread($reply, false, $rootAuthorDid);
|
||||||
}
|
}
|
||||||
if ($repliesHtml !== '') {
|
if ($repliesHtml !== '') {
|
||||||
$html .= '<div class="bsky-replies" style="border-left:2px solid #e1e8ed;margin-left:24px;padding-left:0;">';
|
$html .= '<div class="bsky-replies" style="border-left:2px solid #e1e8ed;margin-left:24px;padding-left:12px;">';
|
||||||
$html .= $repliesHtml;
|
$html .= $repliesHtml;
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
}
|
}
|
||||||
@@ -263,7 +263,7 @@ final class BlueskyThreadsExtension extends Minz_Extension {
|
|||||||
$embedHtml = $embed !== null ? $this->renderEmbed($embed) : '';
|
$embedHtml = $embed !== null ? $this->renderEmbed($embed) : '';
|
||||||
|
|
||||||
$rootStyle = 'border:1px solid #cfd9de;border-radius:12px;padding:12px 16px;margin-bottom:12px;';
|
$rootStyle = 'border:1px solid #cfd9de;border-radius:12px;padding:12px 16px;margin-bottom:12px;';
|
||||||
$replyStyle = 'padding:10px 12px;margin:4px 0;';
|
$replyStyle = 'padding:10px 12px;margin:8px 0;';
|
||||||
$style = $isRoot ? $rootStyle : $replyStyle;
|
$style = $isRoot ? $rootStyle : $replyStyle;
|
||||||
|
|
||||||
return <<<HTML
|
return <<<HTML
|
||||||
@@ -376,17 +376,14 @@ final class BlueskyThreadsExtension extends Minz_Extension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return <<<HTML
|
return <<<HTML
|
||||||
<div style="border:1px solid #0085ff;border-radius:12px;padding:10px 12px;margin-top:8px;">
|
<blockquote style="border:1px solid #0085ff;border-radius:12px;padding:10px 12px;margin:8px 0 0 0;">
|
||||||
<div style="font-size:0.85em;margin-bottom:6px;">
|
<div style="font-size:0.85em;margin-bottom:6px;">
|
||||||
<strong>{$displayName}</strong>
|
<strong>{$displayName}</strong>
|
||||||
<span style="color:#536471;margin-left:4px;">@{$this->e($handle)}</span>
|
<a href="{$this->e($postUrl)}" style="color:#536471;margin-left:4px;text-decoration:none;">@{$this->e($handle)}</a>
|
||||||
</div>
|
</div>
|
||||||
<div style="white-space:pre-wrap;word-break:break-word;">{$text}</div>
|
<div style="white-space:pre-wrap;word-break:break-word;">{$text}</div>
|
||||||
{$embedsHtml}
|
{$embedsHtml}
|
||||||
<div style="margin-top:6px;font-size:0.75em;">
|
</blockquote>
|
||||||
<a href="{$this->e($postUrl)}" style="color:#536471;">View on Bluesky ↗</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
HTML;
|
HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -164,14 +164,15 @@ class BlueskyThreadsTest extends TestCase {
|
|||||||
'Quoted post text must be rendered as an embed');
|
'Quoted post text must be rendered as an embed');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Quoted posts include a "View on Bluesky" link; thread posts do not. */
|
/** Quoted posts use a blockquote with a handle permalink; thread posts have no permalink. */
|
||||||
public function testViewOnBskyLinksArePresent(): void {
|
public function testViewOnBskyLinksArePresent(): void {
|
||||||
$data = json_decode(file_get_contents(__DIR__ . '/fixtures/thread_3mhtk7awhrp26.json'), true);
|
$data = json_decode(file_get_contents(__DIR__ . '/fixtures/thread_3mhtk7awhrp26.json'), true);
|
||||||
$html = $this->call('renderThread', $data['thread'], true);
|
$html = $this->call('renderThread', $data['thread'], true);
|
||||||
|
|
||||||
$this->assertStringNotContainsString('3mhtk7awhrp26', $html, 'Thread post rkey must not appear as a permalink');
|
$this->assertStringNotContainsString('3mhtk7awhrp26', $html, 'Thread post rkey must not appear as a permalink');
|
||||||
$this->assertStringContainsString('3mhtjo3rtkn26', $html, 'Quoted post rkey must appear in its View on Bluesky link');
|
$this->assertStringContainsString('3mhtjo3rtkn26', $html, 'Quoted post rkey must appear in the handle permalink');
|
||||||
$this->assertStringContainsString('View on Bluesky', $html);
|
$this->assertStringContainsString('<blockquote', $html, 'Quoted post must be wrapped in a blockquote');
|
||||||
|
$this->assertStringNotContainsString('View on Bluesky', $html);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user