Merge pull request #534 from jonnybarnes/533-handle-finding-webmentions-better

Handle finding webmention targets better
This commit is contained in:
Jonny Barnes 2022-11-09 20:06:02 +00:00 committed by GitHub
commit 4f4f7769da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 2 deletions

View file

@ -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);
}
/**

View file

@ -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'));
}
}