Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: v1.14.2 #2793

Merged
merged 6 commits into from Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 10 additions & 4 deletions CHANGELOG.md
@@ -1,12 +1,18 @@
# Changelog

## 1.14.2

### Chores / Bugfixes

- [#2792](https://github.com/wp-graphql/wp-graphql/pull/2792): fix: uri field is null when querying the page for posts uri

## 1.14.1

## New Features
### New Features

- [#2763](https://github.com/wp-graphql/wp-graphql/pull/2763): feat: add `shouldShowAdminToolbar` field to the User type, resolving from the "show_admin_bar_front" meta value. Thanks @blakewilson!

## Chores / Bugfixes
### Chores / Bugfixes

- [#2758](https://github.com/wp-graphql/wp-graphql/pull/2758): fix: Allow post types and taxonomies to be registered without "graphql_plural_name".
- [#2762](https://github.com/wp-graphql/wp-graphql/pull/2762): Bump webpack version.
Expand All @@ -22,7 +28,7 @@

## 1.14.0

## New Features
### New Features

- [#2745](https://github.com/wp-graphql/wp-graphql/pull/2745): feat: Allow fields, connections and mutations to optionally be registered with undersores in the field name.
- [#2651](https://github.com/wp-graphql/wp-graphql/pull/2651): feat: Add `deregister_graphql_mutation()` and `graphql_excluded_mutations` filter. Thanks @justlevine!
Expand All @@ -31,7 +37,7 @@
- [#2643](https://github.com/wp-graphql/wp-graphql/pull/2643): feat: Add post_lock check on edit/delete mutation. Thanks @markkelnar!
- [#2649](https://github.com/wp-graphql/wp-graphql/pull/2649): feat: Add `pageInfo` field to the Connection type.

## Chores / Bugfixes
### Chores / Bugfixes

- [#2752](https://github.com/wp-graphql/wp-graphql/pull/2752): fix: handle 404s in NodeResolver.php. Thanks @justlevine!
- [#2735](https://github.com/wp-graphql/wp-graphql/pull/2735): fix: Explicitly check for DEBUG enabled value for tests. Thanks @markkelnar!
Expand Down
8 changes: 7 additions & 1 deletion readme.txt
Expand Up @@ -4,7 +4,7 @@ Tags: GraphQL, API, Gatsby, Headless, Decoupled, React, Nextjs, Vue, Apollo, RES
Requires at least: 5.0
Tested up to: 6.1
Requires PHP: 7.1
Stable tag: 1.14.1
Stable tag: 1.14.2
License: GPL-3
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -232,6 +232,12 @@ Composer dependencies are no longer versioned in Github. Recommended install sou

== Changelog ==

= 1.14.2 =

**Chores / Bugfixes**

- [#2792](https://github.com/wp-graphql/wp-graphql/pull/2792): fix: uri field is null when querying the page for posts uri

= 1.14.1 =

**New Features**
Expand Down
3 changes: 1 addition & 2 deletions src/Data/NodeResolver.php
Expand Up @@ -201,8 +201,7 @@ public function resolve_uri( string $uri, $extra_query_vars = '' ) {
return null;
}

/** @todo resolve to an Archive Type. */
$post_type_object = get_post_type_object( $queried_object->post_type );
$post_type_object = get_post_type_object( 'post' );

if ( ! $post_type_object ) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion src/WPGraphQL.php
Expand Up @@ -127,7 +127,7 @@ private function setup_constants() {

// Plugin version.
if ( ! defined( 'WPGRAPHQL_VERSION' ) ) {
define( 'WPGRAPHQL_VERSION', '1.14.1' );
define( 'WPGRAPHQL_VERSION', '1.14.2' );
}

// Plugin Folder Path.
Expand Down
57 changes: 54 additions & 3 deletions tests/wpunit/NodeByUriTest.php
Expand Up @@ -1084,13 +1084,13 @@ public function testPostFormatByUri() {
codecept_debug( $uri );

$term = get_term_by('slug', 'post-format-aside', 'post_format');

/**
* NodeResolver::parse_request() will generate the following query vars:
* uri => /type/aside/
* post_format => post-format-aside
* post_type => [ post ]
*
*
*/
$actual = $this->graphql([
'query' => $query,
Expand Down Expand Up @@ -1669,7 +1669,7 @@ public function testPageQueryWhenPageIsSetToHomePage() {
}

/**
* Tests the Posts Archive Page URI
* Tests the Posts Archive Page URI
*/
public function testPageForPostsByUri() {

Expand Down Expand Up @@ -1894,6 +1894,57 @@ public function testNodeByUriWithCustomPermalinkStructureAndFrontPageSet() {
// cleanup
update_option( 'page_on_front', 0 );
update_option( 'show_on_front', 0 );
wp_delete_post( $page_id, true );

}

public function testQueryPostsPageByUriReturnsExpectedUriOnNode() {

$page_id = $this->factory()->post->create([
'post_type' => 'page',
'post_status' => 'publish',
]);

$page_for_posts = $this->factory()->post->create([
'post_type' => 'page',
'post_status' => 'publish',
'post_title' => 'Page for Posts'
]);

update_option( 'page_on_front', $page_id );
update_option( 'show_on_front', 'page' );
update_option( 'page_for_posts', $page_for_posts );

$query = '
query GetPostsPage( $uri: String! ) {
nodeByUri(uri: $uri) {
__typename
uri
}
}
';

$uri = parse_url( get_permalink( $page_for_posts ), PHP_URL_PATH );

$variables = [
'uri' => $uri
];

codecept_debug( [
'variables' => $variables,
]);

$actual = $this->graphql([
'query' => $query,
'variables' => $variables
]);

self::assertQuerySuccessful( $actual, [
// the query should return a null value as the uri
// cannot be found
$this->expectedField( 'nodeByUri.__typename', 'ContentType' ),
$this->expectedField( 'nodeByUri.uri', $uri ),
] );

}

Expand Down
4 changes: 2 additions & 2 deletions wp-graphql.php
Expand Up @@ -6,7 +6,7 @@
* Description: GraphQL API for WordPress
* Author: WPGraphQL
* Author URI: http://www.wpgraphql.com
* Version: 1.14.1
* Version: 1.14.2
* Text Domain: wp-graphql
* Domain Path: /languages/
* Requires at least: 5.0
Expand All @@ -18,7 +18,7 @@
* @package WPGraphQL
* @category Core
* @author WPGraphQL
* @version 1.14.1
* @version 1.14.2
*/

// Exit if accessed directly.
Expand Down