diff --git a/adminSiteServer/apiRouter.ts b/adminSiteServer/apiRouter.ts index 5881c6ee5e0..b5c327009de 100644 --- a/adminSiteServer/apiRouter.ts +++ b/adminSiteServer/apiRouter.ts @@ -2273,6 +2273,7 @@ apiRouter.get("/posts.json", async (req) => { db .knexInstance() .from(postsTable) + .whereNotIn("type", ["wp_block"]) .orderBy("updated_at_in_wordpress", "desc") ) diff --git a/baker/SiteBaker.tsx b/baker/SiteBaker.tsx index 94c47e0fad4..f9b484abdac 100644 --- a/baker/SiteBaker.tsx +++ b/baker/SiteBaker.tsx @@ -152,7 +152,7 @@ export class SiteBaker { if (!this.bakeSteps.has("embeds")) return // Find all grapher urls used as embeds in all posts on the site const rows = await wpdb.singleton.query( - `SELECT post_content FROM wp_posts WHERE (post_type='page' OR post_type='post' OR post_type='wp_block') AND post_status='publish'` + `SELECT post_content FROM wp_posts WHERE (post_type='page' OR post_type='post') AND post_status='publish'` ) let grapherUrls = [] for (const row of rows) { @@ -553,6 +553,7 @@ export class SiteBaker { const rows = (await db .knexTable(postsTable) .where({ status: "publish" }) + .whereNotIn("type", ["wp_block"]) .join("post_tags", { "post_tags.post_id": "posts.id" }) .join("tags", { "tags.id": "post_tags.tag_id" }) .where({ "tags.name": "Entries" }) diff --git a/baker/siteRenderers.tsx b/baker/siteRenderers.tsx index bbab28c496c..3f6e845119b 100644 --- a/baker/siteRenderers.tsx +++ b/baker/siteRenderers.tsx @@ -401,6 +401,7 @@ ${posts export const entriesByYearPage = async (year?: number) => { const entries = (await knexTable(postsTable) .where({ status: "publish" }) + .whereNotIn("type", ["wp_block"]) .join("post_tags", { "post_tags.post_id": "posts.id" }) .join("tags", { "tags.id": "post_tags.tag_id" }) .where({ "tags.name": "Entries" }) diff --git a/db/db.ts b/db/db.ts index fb04c286fdd..7af7ed13648 100644 --- a/db/db.ts +++ b/db/db.ts @@ -122,7 +122,7 @@ export const getSlugsWithPublishedGdocsSuccessors = async (): Promise< return knexRaw( `-- sql select slug from posts_with_gdoc_publish_status - where isGdocPublished = TRUE` + where isGdocPublished = TRUE and type <> 'wp_block'` ) .then((res) => res[0]) .then((rows) => new Set(rows.map((row: any) => row.slug))) diff --git a/db/syncPostsToGrapher.ts b/db/syncPostsToGrapher.ts index 41858cbed75..f2096c5388b 100644 --- a/db/syncPostsToGrapher.ts +++ b/db/syncPostsToGrapher.ts @@ -54,7 +54,7 @@ function buildReplacerFunction( ) => { const block = blocks[matches["id"].toString()] return block - ? `` + + ? `\n` + block.post_content : "" } @@ -262,7 +262,7 @@ const syncPostsToGrapher = async (): Promise => { 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' ` ) diff --git a/db/wpdb.ts b/db/wpdb.ts index a0939f16aec..ee3b7c1c438 100644 --- a/db/wpdb.ts +++ b/db/wpdb.ts @@ -731,6 +731,7 @@ export const getRelatedResearchAndWritingForVariable = async ( -- be disregarded and componentType = 'src' and cd.variableId = ? + and p.type <> 'wp_block' 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 coalesce(pg.published, 0) = 0 -- ignore posts if the wp post has a published gdoc successor. The