Filter thread replies to original author only
All checks were successful
CI / test (push) Successful in 45s
All checks were successful
CI / test (push) Successful in 45s
Only replies from the root post's author are rendered; replies from other users are skipped. Adds fixture and test for a real-world post with an other-author reply (3mhypinzezo2l). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -174,6 +174,25 @@ class BlueskyThreadsTest extends TestCase {
|
||||
$this->assertStringContainsString('View on Bluesky', $html);
|
||||
}
|
||||
|
||||
/**
|
||||
* A post with only a reply from another user (3mhypinzezo2l fixture) must
|
||||
* render just the root post — the other-author reply is filtered out.
|
||||
*/
|
||||
public function testOtherAuthorRepliesAreExcluded(): void {
|
||||
$data = json_decode(file_get_contents(__DIR__ . '/fixtures/thread_3mhypinzezo2l.json'), true);
|
||||
$thread = $data['thread'];
|
||||
$rootAuthorDid = $thread['post']['author']['did'];
|
||||
|
||||
$html = $this->call('renderThread', $thread, true, $rootAuthorDid);
|
||||
|
||||
$this->assertSame(1, substr_count($html, 'bsky-post'),
|
||||
'Only the root post should be rendered; other-author reply must be excluded');
|
||||
$this->assertSame(0, substr_count($html, 'bsky-replies'),
|
||||
'No replies wrapper should be rendered when all replies are from other authors');
|
||||
$this->assertStringNotContainsString('lasagnazero.bsky.social', $html,
|
||||
'Reply author handle must not appear in output');
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// applyFacets — rich-text rendering
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user