From b86dd4fab1712909d7c4b88815f8fe14d35ff30a Mon Sep 17 00:00:00 2001 From: Willow Celeste <54474119+willowCeleste@users.noreply.github.com> Date: Wed, 17 Jul 2024 13:58:34 -0400 Subject: [PATCH 1/7] Adds filter to control max number of posts in query block --- blocks/query/block.json | 4 ---- blocks/query/edit.tsx | 7 ++++--- blocks/query/index.php | 8 ++++++++ blocks/query/types.ts | 1 - 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/blocks/query/block.json b/blocks/query/block.json index ce1c50cd..02d5fcac 100644 --- a/blocks/query/block.json +++ b/blocks/query/block.json @@ -28,10 +28,6 @@ ], "type": "string" }, - "maxNumberOfPosts": { - "default": 10, - "type": "number" - }, "minNumberOfPosts": { "default": 1, "type": "number" diff --git a/blocks/query/edit.tsx b/blocks/query/edit.tsx index 5e8cf7b5..7cd219ff 100644 --- a/blocks/query/edit.tsx +++ b/blocks/query/edit.tsx @@ -45,6 +45,7 @@ interface Window { allowedPostTypes: Array; allowedTaxonomies: Array; parselyAvailable: string, + maxPosts: number, }; } @@ -60,7 +61,6 @@ export default function Edit({ attributes: { backfillPosts = [], deduplication = 'inherit', - maxNumberOfPosts = 10, minNumberOfPosts = 1, numberOfPosts = 5, offset = 0, @@ -79,6 +79,7 @@ export default function Edit({ allowedPostTypes = [], allowedTaxonomies = [], parselyAvailable = 'false', + maxPosts = 10, } = {}, } = (window as any as Window); @@ -305,14 +306,14 @@ export default function Edit({ title={__('Setup', 'wp-curate')} initialOpen > - {minNumberOfPosts !== undefined && minNumberOfPosts !== maxNumberOfPosts ? ( + {minNumberOfPosts !== undefined && minNumberOfPosts !== maxPosts ? ( ) : null} $allowed_post_types, 'allowedTaxonomies' => $allowed_taxonomies, 'parselyAvailable' => $parsely_available ? 'true' : 'false', + 'maxPosts' => $max_posts, ] ); } diff --git a/blocks/query/types.ts b/blocks/query/types.ts index 077b92a1..b58f4cac 100644 --- a/blocks/query/types.ts +++ b/blocks/query/types.ts @@ -2,7 +2,6 @@ interface EditProps { attributes: { backfillPosts?: number[]; deduplication?: string; - maxNumberOfPosts?: number; minNumberOfPosts?: number; numberOfPosts?: number; offset?: number; From 852c300ba53ae9120301f771ec5b8a42346808fd Mon Sep 17 00:00:00 2001 From: Willow Celeste <54474119+willowCeleste@users.noreply.github.com> Date: Wed, 17 Jul 2024 14:02:28 -0400 Subject: [PATCH 2/7] PHPCS issues --- blocks/query/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blocks/query/index.php b/blocks/query/index.php index c3eb0833..f979f544 100644 --- a/blocks/query/index.php +++ b/blocks/query/index.php @@ -48,7 +48,7 @@ function wp_curate_query_block_init(): void { * * @param integer $max_posts The maximum number of posts to display. */ - $max_posts = apply_filters('wp_curate_max_posts', 5); + $max_posts = apply_filters( 'wp_curate_max_posts', 5 ); /** * Filter whether to use Parsely. @@ -63,7 +63,7 @@ function wp_curate_query_block_init(): void { 'allowedPostTypes' => $allowed_post_types, 'allowedTaxonomies' => $allowed_taxonomies, 'parselyAvailable' => $parsely_available ? 'true' : 'false', - 'maxPosts' => $max_posts, + 'maxPosts' => $max_posts, ] ); } From cc2250362252cd4b31431d448407ee371876de83 Mon Sep 17 00:00:00 2001 From: Willow Celeste <54474119+willowCeleste@users.noreply.github.com> Date: Thu, 18 Jul 2024 10:21:59 -0400 Subject: [PATCH 3/7] Update blocks/query/index.php Co-authored-by: Greg Marshall --- blocks/query/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blocks/query/index.php b/blocks/query/index.php index f979f544..e4e2e333 100644 --- a/blocks/query/index.php +++ b/blocks/query/index.php @@ -44,7 +44,7 @@ function wp_curate_query_block_init(): void { $allowed_taxonomies = apply_filters( 'wp_curate_allowed_taxonomies', [ 'category', 'post_tag' ] ); /** - * Filter the taxonomies that can be used in the Query block. + * Filter the maximum number of posts that can be displayed in the Query block. * * @param integer $max_posts The maximum number of posts to display. */ From 66c606b3d21b5c8263c6b4b253b529b7f2d2dfa2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 31 Aug 2024 13:10:18 +0000 Subject: [PATCH 4/7] Bump wp-types from 4.66.0 to 4.66.1 Bumps [wp-types](https://github.com/johnbillion/wp-json-schemas) from 4.66.0 to 4.66.1. - [Release notes](https://github.com/johnbillion/wp-json-schemas/releases) - [Commits](https://github.com/johnbillion/wp-json-schemas/compare/4.66.0...4.66.1) --- updated-dependencies: - dependency-name: wp-types dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 02989c50..76af5716 100644 --- a/package-lock.json +++ b/package-lock.json @@ -47,7 +47,7 @@ "ts-jest": "^29.2.5", "typescript": "^5.5.4", "webpack-cli": "^5.1.4", - "wp-types": "^4.66.0" + "wp-types": "^4.66.1" }, "engines": { "node": "20", @@ -24952,9 +24952,9 @@ "dev": true }, "node_modules/wp-types": { - "version": "4.66.0", - "resolved": "https://registry.npmjs.org/wp-types/-/wp-types-4.66.0.tgz", - "integrity": "sha512-IAYg8mubT1hNg1fyumojLe89BxZDYyAvXU3uIaa3mplin7TBqvuFitYpT+za/NOXtiBgDtBvlsnegr6cjIq8vA==", + "version": "4.66.1", + "resolved": "https://registry.npmjs.org/wp-types/-/wp-types-4.66.1.tgz", + "integrity": "sha512-T2sEGcg3MdQ1vojiEMfzO4JpXUPdb+FWgflM6FZln0UTvFwmDBKyNyTik3ODu0nNdAtaSAJzR/HYyqBerKP31g==", "dev": true, "dependencies": { "typescript": ">=4" diff --git a/package.json b/package.json index 0e235005..e28ffce7 100644 --- a/package.json +++ b/package.json @@ -74,6 +74,6 @@ "ts-jest": "^29.2.5", "typescript": "^5.5.4", "webpack-cli": "^5.1.4", - "wp-types": "^4.66.0" + "wp-types": "^4.66.1" } } From 4d1c24374dc4fdc0c8c755d47e8b31cb2af45fd6 Mon Sep 17 00:00:00 2001 From: Kevin Fodness <2650828+kevinfodness@users.noreply.github.com> Date: Wed, 4 Sep 2024 12:33:54 -0400 Subject: [PATCH 5/7] Update blocks/query/index.php --- blocks/query/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blocks/query/index.php b/blocks/query/index.php index e4e2e333..ecf9d464 100644 --- a/blocks/query/index.php +++ b/blocks/query/index.php @@ -48,7 +48,7 @@ function wp_curate_query_block_init(): void { * * @param integer $max_posts The maximum number of posts to display. */ - $max_posts = apply_filters( 'wp_curate_max_posts', 5 ); + $max_posts = apply_filters( 'wp_curate_max_posts', 10 ); /** * Filter whether to use Parsely. From 536b48ca11c5730f043e87b3dfab35ff362d02a1 Mon Sep 17 00:00:00 2001 From: Sam Hermes Date: Mon, 9 Sep 2024 10:34:50 -0500 Subject: [PATCH 6/7] If the block transforms menu is open, skip deduplication --- services/deduplicate/index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/deduplicate/index.ts b/services/deduplicate/index.ts index 1d8d84c2..4247280e 100644 --- a/services/deduplicate/index.ts +++ b/services/deduplicate/index.ts @@ -89,6 +89,11 @@ export function mainDedupe() { return; } + // If the block transforms menu is currently open, skip deduplication. + if (document.querySelector('.block-editor-block-switcher__popover__preview__parent')) { + return; + } + running = true; // Clear the flag for another run. redo = false; From af753c4476d7e328049671d88bc8543b44007ef0 Mon Sep 17 00:00:00 2001 From: Sam Hermes Date: Mon, 9 Sep 2024 15:11:18 -0500 Subject: [PATCH 7/7] Version 2.3.2 --- CHANGELOG.md | 4 ++++ wp-curate.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89bae665..a634cdec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to `WP Curate` will be documented in this file. +## 2.3.2 - 2024-09-09 + +- Bug Fix: Prevent block transforms from crashing the Query block. + ## 2.3.1 - 2024-08-28 - Bug Fix: Backfill posts filling out of order in the Editor. diff --git a/wp-curate.php b/wp-curate.php index 7c6ee2f8..6aed2a5c 100644 --- a/wp-curate.php +++ b/wp-curate.php @@ -3,7 +3,7 @@ * Plugin Name: WP Curate * Plugin URI: https://github.com/alleyinteractive/wp-curate * Description: Plugin to curate homepages and other landing pages - * Version: 2.3.1 + * Version: 2.3.2 * Author: Alley Interactive * Author URI: https://github.com/alleyinteractive/wp-curate * Requires at least: 6.4