Skip to content

Commit

Permalink
Merge branch 'develop' into feat/post-object-cursor-filters
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonbahl authored Aug 28, 2023
2 parents 7d5b56c + 970868f commit da3476f
Show file tree
Hide file tree
Showing 25 changed files with 110 additions and 64 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/deploy-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,23 @@ jobs:
php: [ '8.1', '8.0', '7.4', '7.3' ]
wordpress: [ '6.2', '6.1', '6.0', '5.9', '5.8', '5.7.2', '5.6', '5.5.3' ]
include:
- php: '8.1'
wordpress: 'beta-6.3'
- php: '8.2'
wordpress: 'beta-6.3'
wordpress: '6.1'
- php: '8.2'
wordpress: '6.2'
- php: '8.2'
wordpress: '6.3'
- php: '8.1'
wordpress: '6.3'
exclude:
- php: '8.0'
wordpress: '5.5.3'
- php: '8.1'
wordpress: '5.5.3'
- php: '8.1'
wordpress: '5.6'
- php: '8.1'
wordpress: '5.7.2'
- php: '8.0'
wordpress: '5.5.3'
- php: '7.3'
wordpress: '6.0'
- php: '7.3'
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/testing-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,20 @@ jobs:
fail-fast: false
matrix:
php: [ '8.2', '8.1', '8.0' ]
wordpress: [ '6.2', '6.1' ]
wordpress: [ '6.3', '6.2', '6.1' ]
include:
- php: '8.1'
wordpress: 'beta-6.3'
- php: '8.1'
wordpress: '6.2'
multisite: true
- php: '8.1'
wordpress: '6.2'
coverage: 1
- php: '8.1'
wordpress: '6.1'
- php: '8.1'
wordpress: '6.0'
- php: '8.1'
wordpress: '5.9'
- php: '7.4'
wordpress: '6.1.1'
- php: '7.3'
wordpress: '5.9'
- php: '7.3'
Expand All @@ -46,8 +44,6 @@ jobs:
wordpress: '5.7'
- php: '7.3'
wordpress: '5.6'
- php: '7.4'
wordpress: '6.1.1'

steps:
- name: Cancel previous runs of this workflow (pull requests only)
Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Changelog

## 1.15.0

### New Features

- [#2908](https://github.com/wp-graphql/wp-graphql/pull/2908): feat: Skip param added to Utils::map_input(). Thanks @kidunot89!

### Chores / Bugfixes

- [#2907](https://github.com/wp-graphql/wp-graphql/pull/2907): ci: Use WP 6.3 image, not the beta one
- [#2902](https://github.com/wp-graphql/wp-graphql/pull/2902): chore: handle unused variables (phpcs). Thanks @justlevine!
- [#2901](https://github.com/wp-graphql/wp-graphql/pull/2901): chore: remove useless ternaries (phpcs). Thanks @justlevine!
- [#2898](https://github.com/wp-graphql/wp-graphql/pull/2898): chore: restore excluded PHPCS sniffs. Thanks @justlevine!
- [#2899](https://github.com/wp-graphql/wp-graphql/pull/2899): chore: Configure PHPCS blank line check and autofix. Thanks @justlevine!
- [#2900](https://github.com/wp-graphql/wp-graphql/pull/2900): chore: implement PHPCS sniffs from Slevomat Coding Standards. Thanks @justlevine!
- [#2897](https://github.com/wp-graphql/wp-graphql/pull/2897): fix: default excerptRendered to empty string. Thanks @izzygld!
- [#2890](https://github.com/wp-graphql/wp-graphql/pull/2890): fix: Use hostname for graphql cache header url for varnish
- [#2892](https://github.com/wp-graphql/wp-graphql/pull/2889): chore: GitHub template tweaks. Thanks @justlevine!
- [#2889](https://github.com/wp-graphql/wp-graphql/pull/2889): ci: update tests to test against WordPress 6.3, simplify the matrix
- [#2891](https://github.com/wp-graphql/wp-graphql/pull/2891): chore: bump graphql-php to 14.11.10 and update Composer dev-deps. Thanks @justlevine!

## 1.14.10

### Chores / Bugfixes
Expand Down
7 changes: 7 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@
<rule ref="SlevomatCodingStandard.Classes.ClassConstantVisibility" />
<rule ref="SlevomatCodingStandard.Classes.UselessLateStaticBinding" />

<rule ref="SlevomatCodingStandard.ControlStructures.UselessTernaryOperator" />

<rule ref="SlevomatCodingStandard.Exceptions.DeadCatch" />
<rule ref="SlevomatCodingStandard.Exceptions.DisallowNonCapturingCatch" />
<rule ref="SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly" />
Expand All @@ -156,4 +158,9 @@
<rule ref="SlevomatCodingStandard.PHP.TypeCast" />

<rule ref="SlevomatCodingStandard.Variables.DuplicateAssignmentToVariable" />
<rule ref="SlevomatCodingStandard.Variables.UnusedVariable" >
<properties>
<property name="ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach" value="true" />
</properties>
</rule>
</ruleset>
23 changes: 22 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: GraphQL, JSON, API, Gatsby, Faust, Headless, Decoupled, Svelte, React, Nex
Requires at least: 5.0
Tested up to: 6.2
Requires PHP: 7.1
Stable tag: 1.14.10
Stable tag: 1.15.0
License: GPL-3
License URI: https://www.gnu.org/licenses/gpl-3.0.html

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

== Changelog ==

= 1.15.0 =

**New Features**

- [#2908](https://github.com/wp-graphql/wp-graphql/pull/2908): feat: Skip param added to Utils::map_input(). Thanks @kidunot89!

**Chores / Bugfixes**

- [#2907](https://github.com/wp-graphql/wp-graphql/pull/2907): ci: Use WP 6.3 image, not the beta one
- [#2902](https://github.com/wp-graphql/wp-graphql/pull/2902): chore: handle unused variables (phpcs). Thanks @justlevine!
- [#2901](https://github.com/wp-graphql/wp-graphql/pull/2901): chore: remove useless ternaries (phpcs). Thanks @justlevine!
- [#2898](https://github.com/wp-graphql/wp-graphql/pull/2898): chore: restore excluded PHPCS sniffs. Thanks @justlevine!
- [#2899](https://github.com/wp-graphql/wp-graphql/pull/2899): chore: Configure PHPCS blank line check and autofix. Thanks @justlevine!
- [#2900](https://github.com/wp-graphql/wp-graphql/pull/2900): chore: implement PHPCS sniffs from Slevomat Coding Standards. Thanks @justlevine!
- [#2897](https://github.com/wp-graphql/wp-graphql/pull/2897): fix: default excerptRendered to empty string. Thanks @izzygld!
- [#2890](https://github.com/wp-graphql/wp-graphql/pull/2890): fix: Use hostname for graphql cache header url for varnish
- [#2892](https://github.com/wp-graphql/wp-graphql/pull/2889): chore: GitHub template tweaks. Thanks @justlevine!
- [#2889](https://github.com/wp-graphql/wp-graphql/pull/2889): ci: update tests to test against WordPress 6.3, simplify the matrix
- [#2891](https://github.com/wp-graphql/wp-graphql/pull/2891): chore: bump graphql-php to 14.11.10 and update Composer dev-deps. Thanks @justlevine!


= 1.14.10 =

**Chores / Bugfixes**
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/GraphiQL/GraphiQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class GraphiQL {
* @return void
*/
public function init() {
$this->is_enabled = get_graphql_setting( 'graphiql_enabled' ) === 'off' ? false : true;
$this->is_enabled = get_graphql_setting( 'graphiql_enabled' ) !== 'off';

/**
* If GraphiQL is disabled, don't set it up in the Admin
Expand Down
4 changes: 2 additions & 2 deletions src/Admin/Settings/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function register_settings() {
'type' => 'text',
'value' => ! empty( $custom_endpoint ) ? $custom_endpoint : null,
'default' => ! empty( $custom_endpoint ) ? $custom_endpoint : 'graphql',
'disabled' => ! empty( $custom_endpoint ) ? true : false,
'disabled' => ! empty( $custom_endpoint ),
'sanitize_callback' => static function ( $value ) {
if ( empty( $value ) ) {
add_settings_error( 'graphql_endpoint', 'required', __( 'The "GraphQL Endpoint" field is required and cannot be blank. The default endpoint is "graphql"', 'wp-graphql' ), 'error' );
Expand Down Expand Up @@ -194,7 +194,7 @@ public function register_settings() {
: __( 'Whether GraphQL requests should execute in "debug" mode. This setting is disabled if <strong>GRAPHQL_DEBUG</strong> is defined in wp-config.php. <br/>This will provide more information in GraphQL errors but can leak server implementation details so this setting is <strong>NOT RECOMMENDED FOR PRODUCTION ENVIRONMENTS</strong>.', 'wp-graphql' ),
'type' => 'checkbox',
'value' => true === \WPGraphQL::debug() ? 'on' : get_graphql_setting( 'debug_mode_enabled', 'off' ),
'disabled' => defined( 'GRAPHQL_DEBUG' ) ? true : false,
'disabled' => defined( 'GRAPHQL_DEBUG' ),
],
[
'name' => 'tracing_enabled',
Expand Down
3 changes: 1 addition & 2 deletions src/Admin/Settings/SettingsRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,6 @@ public function callback_wysiwyg( array $args ) {
public function callback_file( array $args ) {
$value = esc_attr( $this->get_option( $args['id'], $args['section'], $args['std'] ) );
$size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
$id = $args['section'] . '[' . $args['id'] . ']';
$label = isset( $args['options']['button_label'] ) ? $args['options']['button_label'] : __( 'Choose File', 'wp-graphql' );

$html = sprintf( '<input type="text" class="%1$s-text wpsa-url" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s">', $size, $args['section'], $args['id'], $value );
Expand Down Expand Up @@ -583,7 +582,7 @@ public function get_sanitize_callback( $slug = '' ) {
}

// Iterate over registered fields and see if we can find proper callback
foreach ( $this->settings_fields as $section => $options ) {
foreach ( $this->settings_fields as $options ) {
foreach ( $options as $option ) {
if ( $slug !== $option['name'] ) {
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/Data/Connection/EnqueuedScriptsConnectionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function get_loader_name() {
* @return bool
*/
protected function is_valid_model( $model ) {
return isset( $model->handle ) ? true : false;
return isset( $model->handle );
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function get_loader_name() {
* @return bool
*/
protected function is_valid_model( $model ) {
return isset( $model->handle ) ? true : false;
return isset( $model->handle );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Data/NodeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ public function parse_request( string $uri, $extra_query_vars = '' ) {
}

// Convert urldecoded spaces back into '+'.
foreach ( get_taxonomies( [ 'show_in_graphql' => true ], 'objects' ) as $taxonomy => $t ) {
foreach ( get_taxonomies( [ 'show_in_graphql' => true ], 'objects' ) as $t ) {
if ( $t->query_var && isset( $this->wp->query_vars[ $t->query_var ] ) ) {
$this->wp->query_vars[ $t->query_var ] = str_replace( ' ', '+', $this->wp->query_vars[ $t->query_var ] );
}
Expand Down
2 changes: 1 addition & 1 deletion src/Data/PostObjectMutation.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ protected static function set_object_terms( int $post_id, array $input, WP_Post_
/**
* Default append to true, but allow input to set it to false.
*/
$append = isset( $term_input['append'] ) && false === $term_input['append'] ? false : true;
$append = ! isset( $term_input['append'] ) || false !== $term_input['append'];

/**
* Start an array of terms to connect
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ protected function init() {
if ( empty( $registered_templates ) ) {
return $template;
}
$post_type = $this->data->post_type;

$set_template = get_post_meta( $this->data->ID, '_wp_page_template', true );
$template_name = get_page_template_slug( $this->data->ID );

Expand Down
24 changes: 12 additions & 12 deletions src/Model/PostType.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,25 +119,25 @@ protected function init() {
return ! empty( $this->data->public ) ? (bool) $this->data->public : null;
},
'hierarchical' => function () {
return ( true === $this->data->hierarchical || ! empty( $this->data->hierarchical ) ) ? true : false;
return true === $this->data->hierarchical || ! empty( $this->data->hierarchical );
},
'excludeFromSearch' => function () {
return ( true === $this->data->exclude_from_search ) ? true : false;
return true === $this->data->exclude_from_search;
},
'publiclyQueryable' => function () {
return ( true === $this->data->publicly_queryable ) ? true : false;
return true === $this->data->publicly_queryable;
},
'showUi' => function () {
return ( true === $this->data->show_ui ) ? true : false;
return true === $this->data->show_ui;
},
'showInMenu' => function () {
return ( true === $this->data->show_in_menu ) ? true : false;
return true === $this->data->show_in_menu;
},
'showInNavMenus' => function () {
return ( true === $this->data->show_in_nav_menus ) ? true : false;
return true === $this->data->show_in_nav_menus;
},
'showInAdminBar' => function () {
return ( true === $this->data->show_in_admin_bar ) ? true : false;
return true === $this->data->show_in_admin_bar;
},
'menuPosition' => function () {
return ! empty( $this->data->menu_position ) ? $this->data->menu_position : null;
Expand All @@ -146,20 +146,20 @@ protected function init() {
return ! empty( $this->data->menu_icon ) ? $this->data->menu_icon : null;
},
'hasArchive' => function () {
return ! empty( $this->uri ) ? true : false;
return ! empty( $this->uri );
},
'canExport' => function () {
return ( true === $this->data->can_export ) ? true : false;
return true === $this->data->can_export;
},
'deleteWithUser' => function () {
return ( true === $this->data->delete_with_user ) ? true : false;
return true === $this->data->delete_with_user;
},
'taxonomies' => function () {
$object_taxonomies = get_object_taxonomies( $this->data->name );
return ( ! empty( $object_taxonomies ) ) ? $object_taxonomies : null;
},
'showInRest' => function () {
return ( true === $this->data->show_in_rest ) ? true : false;
return true === $this->data->show_in_rest;
},
'restBase' => function () {
return ! empty( $this->data->rest_base ) ? $this->data->rest_base : null;
Expand All @@ -168,7 +168,7 @@ protected function init() {
return ! empty( $this->data->rest_controller_class ) ? $this->data->rest_controller_class : null;
},
'showInGraphql' => function () {
return ( true === $this->data->show_in_graphql ) ? true : false;
return true === $this->data->show_in_graphql;
},
'graphqlSingleName' => function () {
return ! empty( $this->data->graphql_single_name ) ? $this->data->graphql_single_name : null;
Expand Down
18 changes: 9 additions & 9 deletions src/Model/Taxonomy.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,28 +110,28 @@ protected function init() {
return ! empty( $this->data->public ) ? (bool) $this->data->public : true;
},
'hierarchical' => function () {
return ( true === $this->data->hierarchical ) ? true : false;
return true === $this->data->hierarchical;
},
'showUi' => function () {
return ( true === $this->data->show_ui ) ? true : false;
return true === $this->data->show_ui;
},
'showInMenu' => function () {
return ( true === $this->data->show_in_menu ) ? true : false;
return true === $this->data->show_in_menu;
},
'showInNavMenus' => function () {
return ( true === $this->data->show_in_nav_menus ) ? true : false;
return true === $this->data->show_in_nav_menus;
},
'showCloud' => function () {
return ( true === $this->data->show_tagcloud ) ? true : false;
return true === $this->data->show_tagcloud;
},
'showInQuickEdit' => function () {
return ( true === $this->data->show_in_quick_edit ) ? true : false;
return true === $this->data->show_in_quick_edit;
},
'showInAdminColumn' => function () {
return ( true === $this->data->show_admin_column ) ? true : false;
return true === $this->data->show_admin_column;
},
'showInRest' => function () {
return ( true === $this->data->show_in_rest ) ? true : false;
return true === $this->data->show_in_rest;
},
'restBase' => function () {
return ! empty( $this->data->rest_base ) ? $this->data->rest_base : null;
Expand All @@ -140,7 +140,7 @@ protected function init() {
return ! empty( $this->data->rest_controller_class ) ? $this->data->rest_controller_class : null;
},
'showInGraphql' => function () {
return ( true === $this->data->show_in_graphql ) ? true : false;
return true === $this->data->show_in_graphql;
},
'graphqlSingleName' => function () {
return ! empty( $this->data->graphql_single_name ) ? $this->data->graphql_single_name : null;
Expand Down
2 changes: 1 addition & 1 deletion src/Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ static function ( $cap ) {
'shouldShowAdminToolbar' => function () {
$toolbar_preference_meta = get_user_meta( $this->data->ID, 'show_admin_bar_front', true );

return 'true' === $toolbar_preference_meta ? true : false;
return 'true' === $toolbar_preference_meta;
},
'userId' => ! empty( $this->data->ID ) ? absint( $this->data->ID ) : null,
'uri' => function () {
Expand Down
2 changes: 1 addition & 1 deletion src/Mutation/MediaItemCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public static function mutate_and_get_payload() {
$sanitized_file_path = sanitize_file_name( $input['filePath'] );

// Check that the filetype is allowed
$check_file = wp_check_filetype( $uploaded_file_url );
$check_file = wp_check_filetype( $sanitized_file_path );

// if the file doesn't pass the check, throw an error
if ( ! $check_file['ext'] || ! $check_file['type'] || ! wp_http_validate_url( $uploaded_file_url ) ) {
Expand Down
9 changes: 2 additions & 7 deletions src/Type/Enum/TimezoneEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static function register_type() {
load_textdomain( 'continents-cities', $mofile );
$mo_loaded = true;
}

$zonen = [];
foreach ( timezone_identifiers_list() as $zone ) {
$zone = explode( '/', $zone );
Expand Down Expand Up @@ -72,18 +72,13 @@ public static function register_type() {
}
usort( $zonen, '_wp_timezone_choice_usort_callback' );

foreach ( $zonen as $key => $zone ) {
foreach ( $zonen as $zone ) {
// Build value in an array to join later
$value = [ $zone['continent'] ];
if ( empty( $zone['city'] ) ) {
// It's at the continent level (generally won't happen)
$display = $zone['t_continent'];
} else {
// It's inside a continent group
// Continent optgroup
if ( ! isset( $zonen[ $key - 1 ] ) || $zonen[ $key - 1 ]['continent'] !== $zone['continent'] ) {
$label = $zone['t_continent'];
}
// Add the city to the value
$value[] = $zone['city'];
$display = $zone['t_city'];
Expand Down
Loading

0 comments on commit da3476f

Please sign in to comment.