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

🔨 sync not just wp pages and posts but also wp_blocks #3029

Merged
merged 1 commit into from
Dec 21, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions baker/SiteBaker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ export class SiteBaker {
const rows = (await db
.knexTable(postsTable)
.where({ status: "publish" })
.whereNot({ type: "wp_block" })
.join("post_tags", { "post_tags.post_id": "posts.id" })
.join("tags", { "tags.id": "post_tags.tag_id" })
.where({ "tags.name": "Entries" })
Expand Down
1 change: 1 addition & 0 deletions baker/siteRenderers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ ${posts
export const entriesByYearPage = async (year?: number) => {
const entries = (await knexTable(postsTable)
.where({ status: "publish" })
.whereNot({ type: "wp_block" })
.join("post_tags", { "post_tags.post_id": "posts.id" })
.join("tags", { "tags.id": "post_tags.tag_id" })
.where({ "tags.name": "Entries" })
Expand Down
2 changes: 1 addition & 1 deletion db/syncPostsToGrapher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ const syncPostsToGrapher = async (): Promise<void> => {
left join post_ids_with_authors pwa on p.ID = pwa.ID
left join first_revision fr on fr.post_id = pwa.ID
left join post_featured_image fi on fi.ID = p.id
where p.post_type in ('post', 'page') AND post_status != 'trash'
where p.post_type in ('post', 'page', 'wp_block') AND post_status != 'trash'
`
)

Expand Down
1 change: 1 addition & 0 deletions db/wpdb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@ export const getRelatedResearchAndWritingForVariable = async (
and cd.variableId = ?
and cd.property in ('x', 'y') -- ignore cases where the indicator is size, color etc
and p.status = 'publish' -- only use published wp posts
and p.type != 'wp_block'
and coalesce(pg.published, 0) = 0 -- ignore posts if the wp post has a published gdoc successor. The
-- coalesce makes sure that if there is no gdoc successor then
-- the filter keeps the post
Expand Down