Skip to content

Commit

Permalink
Removing manualPosts regression
Browse files Browse the repository at this point in the history
  • Loading branch information
renatonascalves committed Oct 23, 2023
1 parent db2c1b4 commit 55f58d0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
7 changes: 0 additions & 7 deletions blocks/query/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,6 @@
},
"type": "array"
},
"manualPosts": {
"default": [],
"items": {
"type": "number"
},
"type": "array"
},
"posts": {
"default": [],
"items": {
Expand Down
6 changes: 3 additions & 3 deletions blocks/query/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default function Edit({
minNumberOfPosts = 1,
numberOfPosts = 5,
offset = 0,
manualPosts = [],
posts: manualPosts = [],
postTypes = ['post'],
searchTerm = '',
terms = {},
Expand Down Expand Up @@ -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[]) => {
Expand All @@ -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),
});
};

Expand Down
3 changes: 1 addition & 2 deletions blocks/query/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
}
Expand Down
7 changes: 3 additions & 4 deletions services/deduplicate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface Block {
backfillPosts?: number[];
deduplication?: string;
numberOfPosts?: number;
manualPosts?: any[];
posts?: number[];
postTypes?: string[];
query?: {
include?: number[];
Expand Down Expand Up @@ -123,7 +123,7 @@ export function mainDedupe() {
const {
backfillPosts = [],
deduplication = 'inherit',
manualPosts = [],
posts = [],
numberOfPosts = 5,
postTypes = ['post'],
} = attributes;
Expand All @@ -137,7 +137,7 @@ export function mainDedupe() {
const allPostIds: Array<number | undefined> = [];

// New array to hold the pinned posts in the order they should be.
const manualPostIdArray: Array<number | null> = manualPosts;
const manualPostIdArray: Array<number | null> = posts;

// Remove any pinned posts from the backfilled posts list.
const filteredPosts = backfillPosts.filter((post) => !manualPostIdArray.includes(post));
Expand Down Expand Up @@ -192,7 +192,6 @@ export function mainDedupe() {
orderby: 'include',
},
queryId: 0,
posts: allPostIds,
},
);
});
Expand Down

0 comments on commit 55f58d0

Please sign in to comment.