Skip to content

Commit

Permalink
🐛 Fix document list param #1868
Browse files Browse the repository at this point in the history
  • Loading branch information
padms committed Oct 27, 2023
1 parent a50d101 commit 3529074
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 10 deletions.
5 changes: 2 additions & 3 deletions sanityv3/schemas/documents/news.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion sanityv3/src/lib/structure/items/Event.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion sanityv3/src/lib/structure/items/LandingPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions sanityv3/src/lib/structure/items/LocalNews.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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', {
Expand Down
2 changes: 1 addition & 1 deletion sanityv3/src/lib/structure/items/Magazine.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion sanityv3/src/lib/structure/items/News.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion sanityv3/src/lib/structure/items/TopicContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 3529074

Please sign in to comment.