From 35290740a374adfaba44727fba700f8b5f811fb3 Mon Sep 17 00:00:00 2001 From: Padmaja <52911293+padms@users.noreply.github.com> Date: Fri, 27 Oct 2023 13:50:20 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20document=20list=20param=20?= =?UTF-8?q?#1868?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sanityv3/schemas/documents/news.js | 5 ++--- sanityv3/src/lib/structure/items/Event.js | 2 +- sanityv3/src/lib/structure/items/LandingPage.js | 2 +- sanityv3/src/lib/structure/items/LocalNews.js | 4 ++-- sanityv3/src/lib/structure/items/Magazine.js | 2 +- sanityv3/src/lib/structure/items/News.js | 2 +- sanityv3/src/lib/structure/items/TopicContent.js | 2 +- 7 files changed, 9 insertions(+), 10 deletions(-) diff --git a/sanityv3/schemas/documents/news.js b/sanityv3/schemas/documents/news.js index 993b630a2..091b0e1ad 100644 --- a/sanityv3/schemas/documents/news.js +++ b/sanityv3/schemas/documents/news.js @@ -117,10 +117,9 @@ export default { publishedDate: 'publishDateTime', firstPublishedAt: 'firstPublishedAt', isCustomDate: 'customPublicationDate', - lang: 'lang', }, prepare(selection) { - const { title, media, description, publishedDate, firstPublishedAt, isCustomDate, lang } = selection + const { title, media, description, publishedDate, firstPublishedAt, isCustomDate } = selection const date = publishedDate && isCustomDate ? formatDate(publishedDate) @@ -130,7 +129,7 @@ export default { const ingressBlock = (description || []).find((ingressBlock) => ingressBlock._type === 'block') return { title, - subtitle: `${lang} Published date: ${date}`, + subtitle: `Published date: ${date}`, description: ingressBlock ? ingressBlock.children .filter((child) => child._type === 'span') diff --git a/sanityv3/src/lib/structure/items/Event.js b/sanityv3/src/lib/structure/items/Event.js index 83912984d..493b23bef 100644 --- a/sanityv3/src/lib/structure/items/Event.js +++ b/sanityv3/src/lib/structure/items/Event.js @@ -15,7 +15,7 @@ export const Event = (S) => .id('events') .title('Events') .filter('_type == "event" && (!defined(lang) || lang == $baseLang)') - .params({ baseLang: defaultLanguage.iso }) + .params({ baseLang: defaultLanguage.name }) .canHandleIntent((_name, params) => { // Assume we can handle all intents (actions) regarding post documents return params.type === 'event' diff --git a/sanityv3/src/lib/structure/items/LandingPage.js b/sanityv3/src/lib/structure/items/LandingPage.js index 2e1f7c5d6..1dd15c160 100644 --- a/sanityv3/src/lib/structure/items/LandingPage.js +++ b/sanityv3/src/lib/structure/items/LandingPage.js @@ -15,7 +15,7 @@ export const LandingPage = (S) => .id('landingPages') .title('Landing page') .filter('_type == "landingPage" && (!defined(lang) || lang == $baseLang)') - .params({ baseLang: defaultLanguage.iso }) + .params({ baseLang: defaultLanguage.name }) .canHandleIntent((_name, params) => { // Assume we can handle all intents (actions) regarding post documents return params.type === 'landingPage' diff --git a/sanityv3/src/lib/structure/items/LocalNews.js b/sanityv3/src/lib/structure/items/LocalNews.js index c1367ebe7..9d2aa01b9 100644 --- a/sanityv3/src/lib/structure/items/LocalNews.js +++ b/sanityv3/src/lib/structure/items/LocalNews.js @@ -24,7 +24,7 @@ const localNewsStructure = (S, context) => { .id('localNews') .title('Local news articles') .filter('_type == "localNews" && (!defined(lang) || lang == $baseLang)') - .params({ baseLang: defaultLanguage.iso }) + .params({ baseLang: defaultLanguage.name }) .canHandleIntent((_name, params) => { // Assume we can handle all intents (actions) regarding post documents return params.type === 'localNews' @@ -41,7 +41,7 @@ const localNewsStructure = (S, context) => { .title(`Results for: ${tag.title}`) .schemaType(documentName) .filter(`_type == "${documentName}" && references($tagId) && (!defined(lang) || lang == $baseLang)`) - .params({ tagId: tag._id, baseLang: defaultLanguage.iso }) + .params({ tagId: tag._id, baseLang: defaultLanguage.name }) .canHandleIntent(S.documentTypeList(documentName).getCanHandleIntent()) .child((documentId) => S.documentWithInitialValueTemplate('localnews-with-tag', { diff --git a/sanityv3/src/lib/structure/items/Magazine.js b/sanityv3/src/lib/structure/items/Magazine.js index eb997979d..3ee110df0 100644 --- a/sanityv3/src/lib/structure/items/Magazine.js +++ b/sanityv3/src/lib/structure/items/Magazine.js @@ -14,7 +14,7 @@ export const Magazine = (S) => .id('magazines') .title('Magazines') .filter('_type == "magazine" && (!defined(lang) || lang == $baseLang)') - .params({ baseLang: defaultLanguage.iso }) + .params({ baseLang: defaultLanguage.name }) .canHandleIntent((_name, params) => { // Assume we can handle all intents (actions) regarding post documents return params.type === 'magazine' diff --git a/sanityv3/src/lib/structure/items/News.js b/sanityv3/src/lib/structure/items/News.js index af5bb807f..5695ae9ba 100644 --- a/sanityv3/src/lib/structure/items/News.js +++ b/sanityv3/src/lib/structure/items/News.js @@ -14,7 +14,7 @@ export const News = (S) => .id('news') .title('News articles') .filter(' _type == "news" && (!defined(lang) || lang == $baseLang)') - .params({ baseLang: defaultLanguage.iso }) + .params({ baseLang: defaultLanguage.name }) .canHandleIntent((_name, params) => { // Assume we can handle all intents (actions) regarding post documents return params.type === 'news' diff --git a/sanityv3/src/lib/structure/items/TopicContent.js b/sanityv3/src/lib/structure/items/TopicContent.js index 769fb52c1..8da361ca9 100644 --- a/sanityv3/src/lib/structure/items/TopicContent.js +++ b/sanityv3/src/lib/structure/items/TopicContent.js @@ -11,7 +11,7 @@ export const TopicContent = (S) => .id('pages') .title('Topic content') .filter('_type == "page" && (!defined(lang) || lang == $baseLang)') - .params({ baseLang: defaultLanguage.iso }) + .params({ baseLang: defaultLanguage.name }) .canHandleIntent((_name, params) => { // Assume we can handle all intents (actions) regarding post documents return params.type === 'page'