From 5556fb99fc562e7392135fb7611f2e1986bbe8ff Mon Sep 17 00:00:00 2001 From: Josh Worden Date: Thu, 18 Feb 2021 15:32:45 -0600 Subject: [PATCH 1/2] Add withSite parameter to related content field --- .../src/graphql/definitions/platform/content/index.js | 1 + .../graphql-server/src/graphql/resolvers/platform/content.js | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/services/graphql-server/src/graphql/definitions/platform/content/index.js b/services/graphql-server/src/graphql/definitions/platform/content/index.js index 4726c8e5c..59cc8d270 100644 --- a/services/graphql-server/src/graphql/definitions/platform/content/index.js +++ b/services/graphql-server/src/graphql/definitions/platform/content/index.js @@ -430,6 +430,7 @@ input RelatedPublishedContentQueryInput { } input ContentRelatedContentInput { + withSite: Boolean = true siteId: ObjectID excludeContentTypes: [ContentType!] = [] includeContentTypes: [ContentType!] = [] diff --git a/services/graphql-server/src/graphql/resolvers/platform/content.js b/services/graphql-server/src/graphql/resolvers/platform/content.js index 1bd087327..5f41540c7 100644 --- a/services/graphql-server/src/graphql/resolvers/platform/content.js +++ b/services/graphql-server/src/graphql/resolvers/platform/content.js @@ -498,15 +498,14 @@ module.exports = { relatedContent: (doc, { input }, { basedb, site }, info) => { const { queryTypes, + withSite, } = input; // If no query types were specified (owned, inverse, etc), return an empty response. if (!queryTypes.length) return BaseDB.paginateEmpty(); - const siteId = input.siteId || site.id(); - // Run perform the related content query. return relatedContent.performQuery(doc, { - siteId, + ...(withSite && { siteId: input.siteId || site.id() }), input, basedb, info, From 00ce218a0fee94c9ced145ae9dca8bf4dc4aaa53 Mon Sep 17 00:00:00 2001 From: Josh Worden Date: Thu, 18 Feb 2021 15:36:26 -0600 Subject: [PATCH 2/2] =?UTF-8?q?Don=E2=80=99t=20limit=20leaders=20query=20b?= =?UTF-8?q?y=20site?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../leaders-program/src/graphql/queries/content-for-section.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/leaders-program/src/graphql/queries/content-for-section.js b/packages/leaders-program/src/graphql/queries/content-for-section.js index b02a5a693..6905eca2b 100644 --- a/packages/leaders-program/src/graphql/queries/content-for-section.js +++ b/packages/leaders-program/src/graphql/queries/content-for-section.js @@ -73,6 +73,7 @@ query ContentForLeadersSection( teaser(input: { maxLength: 0 }) website promotions: relatedContent(input: { + withSite: false, queryTypes: [company], includeContentTypes: [Promotion], pagination: { limit: $promotionLimit },