4 - Drop status promotion in UrlDiscoveredListener; defer to keywords listener
Some checks failed
CI / ci (push) Failing after 3h0m0s

This commit is contained in:
myrmidex 2026-04-26 03:52:12 +02:00
parent 3ad473f4a1
commit 6b610b699e
2 changed files with 4 additions and 9 deletions

View file

@ -21,17 +21,13 @@ public function handle(UrlDiscovered $event): void
['status' => PageStatusEnum::Discovered, 'instance_id' => $event->instanceId],
);
if ($event->postUrl === null) {
if ($event->postUrl === null || $event->postUrl === $event->url) {
return;
}
$sourcePage = Page::firstOrCreate(
['url' => $event->postUrl],
[
'status' => PageStatusEnum::Fetched,
'instance_id' => $event->instanceId,
'fetched_at' => $event->discoveredAt,
],
['status' => PageStatusEnum::Discovered, 'instance_id' => $event->instanceId],
);
PageLink::firstOrCreate([

View file

@ -72,10 +72,9 @@ public function test_listener_creates_target_page_and_source_page_with_link(): v
// Source page
$sourcePage = Page::where('url', 'https://mastodon.social/@alice/109876543210')->first();
$this->assertNotNull($sourcePage);
$this->assertSame(PageStatusEnum::Fetched, $sourcePage->status);
$this->assertSame(PageStatusEnum::Discovered, $sourcePage->status);
$this->assertSame($instance->id, $sourcePage->instance_id);
$this->assertNotNull($sourcePage->fetched_at);
$this->assertTrue($discoveredAt->equalTo($sourcePage->fetched_at));
$this->assertNull($sourcePage->fetched_at);
// Edge
$link = PageLink::where('source_page_id', $sourcePage->id)