From 55f58d08c637b1c8adca0b66cfbdbc04b9f221c7 Mon Sep 17 00:00:00 2001 From: Renato Alves <19148962+renatonascalves@users.noreply.github.com> Date: Mon, 23 Oct 2023 13:47:21 -0300 Subject: [PATCH] Removing manualPosts regression --- blocks/query/block.json | 7 ------- blocks/query/edit.tsx | 6 +++--- blocks/query/types.ts | 3 +-- services/deduplicate/index.ts | 7 +++---- 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/blocks/query/block.json b/blocks/query/block.json index f8e1b915..e63c62fc 100644 --- a/blocks/query/block.json +++ b/blocks/query/block.json @@ -53,13 +53,6 @@ }, "type": "array" }, - "manualPosts": { - "default": [], - "items": { - "type": "number" - }, - "type": "array" - }, "posts": { "default": [], "items": { diff --git a/blocks/query/edit.tsx b/blocks/query/edit.tsx index 300a96c4..2b887286 100644 --- a/blocks/query/edit.tsx +++ b/blocks/query/edit.tsx @@ -55,7 +55,7 @@ export default function Edit({ minNumberOfPosts = 1, numberOfPosts = 5, offset = 0, - manualPosts = [], + posts: manualPosts = [], postTypes = ['post'], searchTerm = '', terms = {}, @@ -181,7 +181,7 @@ export default function Edit({ const setManualPost = (id: number, index: number) => { const newManualPosts = [...manualPosts]; newManualPosts.splice(index, 1, id); - setAttributes({ manualPosts: newManualPosts }); + setAttributes({ posts: newManualPosts }); }; const setTerms = ((type: string, newTerms: Term[]) => { @@ -203,7 +203,7 @@ export default function Edit({ const setNumberOfPosts = (newValue?: number) => { setAttributes({ numberOfPosts: newValue, - manualPosts: manualPosts.slice(0, newValue), + posts: manualPosts.slice(0, newValue), }); }; diff --git a/blocks/query/types.ts b/blocks/query/types.ts index 4925b408..df1ff4cc 100644 --- a/blocks/query/types.ts +++ b/blocks/query/types.ts @@ -6,8 +6,7 @@ interface EditProps { minNumberOfPosts?: number; numberOfPosts?: number; offset?: number; - posts?: number[]; - manualPosts?: any[]; + posts?: any[]; query: { [key: string]: string | number | number[] | string[]; } diff --git a/services/deduplicate/index.ts b/services/deduplicate/index.ts index 032fbe27..71442672 100644 --- a/services/deduplicate/index.ts +++ b/services/deduplicate/index.ts @@ -11,7 +11,7 @@ interface Block { backfillPosts?: number[]; deduplication?: string; numberOfPosts?: number; - manualPosts?: any[]; + posts?: number[]; postTypes?: string[]; query?: { include?: number[]; @@ -123,7 +123,7 @@ export function mainDedupe() { const { backfillPosts = [], deduplication = 'inherit', - manualPosts = [], + posts = [], numberOfPosts = 5, postTypes = ['post'], } = attributes; @@ -137,7 +137,7 @@ export function mainDedupe() { const allPostIds: Array = []; // New array to hold the pinned posts in the order they should be. - const manualPostIdArray: Array = manualPosts; + const manualPostIdArray: Array = posts; // Remove any pinned posts from the backfilled posts list. const filteredPosts = backfillPosts.filter((post) => !manualPostIdArray.includes(post)); @@ -192,7 +192,6 @@ export function mainDedupe() { orderby: 'include', }, queryId: 0, - posts: allPostIds, }, ); });