Skip to content

Commit

Permalink
✨ Exclude crude oil tags from component #1293
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandolucchesi committed Sep 30, 2022
1 parent fec1fe8 commit 63784fc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions web/lib/queries/news.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import downloadableFileFields from './common/actions/downloadableFileFields'
import downloadableImageFields from './common/actions/downloadableImageFields'
import slugsForNewsAndMagazine from './slugsForNewsAndMagazine'
import { defaultLanguage } from '../../languages'
import { Flags } from '../../common/helpers/datasetHelpers'

export const publishDateTimeQuery = /* groq */ `
select(
Expand All @@ -17,6 +18,9 @@ export const fixPreviewForDrafts = /* groq */ `
((defined(_lang) && _lang == $lang) || (!defined(_lang) && $lang == "${defaultLanguage.name}"))
`

/* @TODO Add 'OR Flags.IS_GLOBAL_PROD' after review */
const excludeCrudeOilAssays = Flags.IS_DEV ? /* groq */ `!('crude-oil-assays' in tags[]->key.current) &&` : ''

export const newsFields = /* groq */ `
"id": _id,
"updatedAt": _updatedAt,
Expand Down Expand Up @@ -95,6 +99,7 @@ export const newsQuery = /* groq */ `
slug.current != $slug &&
heroImage.image.asset != null &&
_lang == $lang &&
${excludeCrudeOilAssays}
// filter drafts, will also filter when previewing
!(_id in path("drafts.**"))
] | order(${publishDateTimeQuery} desc)[0...3] {
Expand Down

0 comments on commit 63784fc

Please sign in to comment.