Skip to content

Commit

Permalink
Merge branch 'develop' into chore/backfill-changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
justlevine authored Mar 23, 2024
2 parents 25b7cd7 + 0378633 commit cc5891c
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 6 deletions.
12 changes: 10 additions & 2 deletions src/Model/UserSeo.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,20 @@ protected function init() {
$this->fields = array_merge(
$this->fields,
[
'breadcrumbTitle' => function (): ?string {
'breadcrumbTitle' => function (): ?string {
$title = $this->get_meta( 'breadcrumb_title', '', $this->data->display_name );

return ! empty( $title ) ? html_entity_decode( $title, ENT_QUOTES ) : null;
},
'ID' => fn (): int => $this->database_id,
'ID' => fn (): int => $this->database_id,
'facebookProfileUrl' => fn (): ?string => get_user_meta( $this->database_id, 'facebook', true ) ?: null,
'twitterUserName' => fn (): ?string => get_user_meta( $this->database_id, 'twitter', true ) ?: null,
'additionalProfiles' => function (): ?array {
$additional_profiles = get_user_meta( $this->database_id, 'additional_profile_urls', true );

return ! empty( $additional_profiles ) ? explode( ' ', $additional_profiles ) : null;
},

]
);
}
Expand Down
15 changes: 14 additions & 1 deletion src/Type/WPObject/SeoObjects.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,20 @@ public static function register(): void {
[
'description' => __( 'The user object SEO data', 'wp-graphql-rank-math' ),
'interfaces' => [ Seo::get_type_name() ],
'fields' => [],
'fields' => [
'facebookProfileUrl' => [
'type' => 'String',
'description' => __( 'The complete Facebook profile URL.', 'wp-graphql-rank-math' ),
],
'twitterUserName' => [
'type' => 'String',
'description' => __( 'Twitter Username of the user.', 'wp-graphql-rank-math' ),
],
'additionalProfiles' => [
'type' => [ 'list_of' => 'String' ],
'description' => __( 'Additional social profile URLs to add to the sameAs property.', 'wp-graphql-rank-math' ),
],
],
'eagerlyLoadType' => true,
]
);
Expand Down
9 changes: 8 additions & 1 deletion tests/functional/UserSeoQueryCept.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@
title
}
}
... on RankMathUserSeo {
additionalProfiles
facebookProfileUrl
twitterUserName
}
}
}
}
Expand Down Expand Up @@ -94,7 +99,9 @@
$I->assertEquals( 'SUMMARY_LARGE_IMAGE', $response_array['data']['user']['seo']['openGraph']['twitterMeta']['card'] );
$I->assertEmpty( $response_array['data']['user']['seo']['openGraph']['twitterMeta']['description'] );
$I->assertEquals( 'testuser - Test', $response_array['data']['user']['seo']['openGraph']['twitterMeta']['title'] );

$I->assertEmpty( $response_array['data']['user']['seo']['additionalProfiles'] );
$I->assertEmpty( $response_array['data']['user']['seo']['facebookProfileUrl'] );
$I->assertEmpty( $response_array['data']['user']['seo']['twitterUserName'] );



Expand Down
8 changes: 8 additions & 0 deletions tests/wpunit/UserSeoQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ public function testUserSeo() {
}
robots
title
... on RankMathUserSeo {
additionalProfiles
facebookProfileUrl
twitterUserName
}
}
}
}
Expand Down Expand Up @@ -103,6 +108,9 @@ public function testUserSeo() {
]
),
$this->expectedField( 'title', 'display - Test' ),
$this->expectedField( 'additionalProfiles', static::IS_NULL ),
$this->expectedField( 'facebookProfileUrl', static::IS_NULL ),
$this->expectedField( 'twitterUserName', static::IS_NULL ),
]
),
]
Expand Down
4 changes: 2 additions & 2 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'name' => 'axepress/wp-graphql-rank-math',
'pretty_version' => 'dev-develop',
'version' => 'dev-develop',
'reference' => '61b4feb73cc74c89520312255ee233a3d270fff5',
'reference' => '68c31b84bdd654febf24ebd5fd63e4ee1dd001d6',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand All @@ -22,7 +22,7 @@
'axepress/wp-graphql-rank-math' => array(
'pretty_version' => 'dev-develop',
'version' => 'dev-develop',
'reference' => '61b4feb73cc74c89520312255ee233a3d270fff5',
'reference' => '68c31b84bdd654febf24ebd5fd63e4ee1dd001d6',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand Down

0 comments on commit cc5891c

Please sign in to comment.