Ensure more metadata

This commit is contained in:
Alex Kirk 2022-12-09 12:02:55 +01:00
parent e065880085
commit 4d05d3710b
3 changed files with 4 additions and 4 deletions

View file

@ -46,7 +46,7 @@ class Mention {
return \sprintf( '<a rel="mention" class="u-url mention href="%s">%s</a>', $metadata['url'], $username );
}
return $username;
return $result[0];
}
public static function extract_mentions( $mentions, \ActivityPub\Model\Post $post ) {

View file

@ -126,8 +126,6 @@ class Webfinger {
$url = \add_query_arg( 'resource', 'acct:' . ltrim( $account, '@' ), 'https://' . $m[1] . '/.well-known/webfinger' );
if ( ! \wp_http_validate_url( $url ) ) {
echo $url;
exit;
return new \WP_Error( 'invalid_webfinger_url', null, $url );
}

View file

@ -2,6 +2,8 @@
class Test_Functions extends ActivityPub_TestCase_Cache_HTTP {
public function test_get_remote_metadata_by_actor() {
$metadata = \ActivityPub\get_remote_metadata_by_actor( 'pfefferle@notiz.blog' );
$this->assertArrayHasKey( 'url', $metadata );
$this->assertEquals( 'https://notiz.blog/author/matthias-pfefferle/', $metadata['url'] );
$this->assertEquals( 'pfefferle', $metadata['preferredUsername'] );
$this->assertEquals( 'Matthias Pfefferle', $metadata['name'] );
}
}