diff --git a/app/Jobs/SendWebMentions.php b/app/Jobs/SendWebMentions.php index 815eb2be..92267d18 100644 --- a/app/Jobs/SendWebMentions.php +++ b/app/Jobs/SendWebMentions.php @@ -100,9 +100,12 @@ class SendWebMentions implements ShouldQueue } elseif (array_key_exists('http://webmention.org/', $rels[0])) { $endpoint = $rels[0]['http://webmention.org/'][0]; } - if ($endpoint) { - return $this->resolveUri($endpoint, $url); + + if ($endpoint === null) { + return null; } + + return $this->resolveUri($endpoint, $url); } /** diff --git a/tests/Unit/Jobs/SendWebMentionJobTest.php b/tests/Unit/Jobs/SendWebMentionJobTest.php index 213ad200..2f185b3a 100644 --- a/tests/Unit/Jobs/SendWebMentionJobTest.php +++ b/tests/Unit/Jobs/SendWebMentionJobTest.php @@ -109,4 +109,18 @@ class SendWebMentionJobTest extends TestCase $job->handle(); $this->assertTrue(true); } + + /** @test */ + public function linksInNotesCanNotSupportWebmentions(): void + { + $mock = new MockHandler([ + new Response(200), + ]); + $handler = HandlerStack::create($mock); + $client = new Client(['handler' => $handler]); + $this->app->instance(Client::class, $client); + + $job = new SendWebMentions(new Note()); + $this->assertNull($job->discoverWebmentionEndpoint('https://example.org')); + } }