published-filter-fix

This commit is contained in:
Untone 2023-11-29 15:19:25 +03:00
parent 76a15c8aa9
commit 7bc743d8a7
4 changed files with 6 additions and 8 deletions

View File

@ -55,7 +55,7 @@ export const HomeView = (props: Props) => {
loadTopMonthArticles() loadTopMonthArticles()
if (sortedArticles().length < PRERENDERED_ARTICLES_COUNT + CLIENT_LOAD_ARTICLES_COUNT) { if (sortedArticles().length < PRERENDERED_ARTICLES_COUNT + CLIENT_LOAD_ARTICLES_COUNT) {
const { hasMore } = await loadShouts({ const { hasMore } = await loadShouts({
filters: { visibility: 'public' }, filters: { published: true },
limit: CLIENT_LOAD_ARTICLES_COUNT, limit: CLIENT_LOAD_ARTICLES_COUNT,
offset: sortedArticles().length, offset: sortedArticles().length,
}) })
@ -84,7 +84,7 @@ export const HomeView = (props: Props) => {
saveScrollPosition() saveScrollPosition()
const { hasMore } = await loadShouts({ const { hasMore } = await loadShouts({
filters: { visibility: 'public' }, filters: { published: true },
limit: LOAD_MORE_PAGE_SIZE, limit: LOAD_MORE_PAGE_SIZE,
offset: sortedArticles().length, offset: sortedArticles().length,
}) })

View File

@ -6,7 +6,7 @@ import { apiClient } from '../graphql/client/core'
export const onBeforeRender = async (_pageContext: PageContext) => { export const onBeforeRender = async (_pageContext: PageContext) => {
const options = { const options = {
filters: { visibility: 'public' }, filters: { published: true },
limit: PRERENDERED_ARTICLES_COUNT, limit: PRERENDERED_ARTICLES_COUNT,
} }
const homeShouts = await apiClient.getShouts({ options }) const homeShouts = await apiClient.getShouts({ options })

View File

@ -20,7 +20,7 @@ export const HomePage = (props: PageProps) => {
} }
await Promise.all([ await Promise.all([
loadShouts({ filters: { visibility: 'public' }, limit: PRERENDERED_ARTICLES_COUNT }), loadShouts({ filters: { published: true }, limit: PRERENDERED_ARTICLES_COUNT }),
loadRandomTopics({ amount: RANDOM_TOPICS_COUNT }), loadRandomTopics({ amount: RANDOM_TOPICS_COUNT }),
]) ])

View File

@ -191,7 +191,7 @@ export const loadTopMonthArticles = async (): Promise<void> => {
const after = Math.floor(daysago / 1000) const after = Math.floor(daysago / 1000)
const options: LoadShoutsOptions = { const options: LoadShoutsOptions = {
filters: { filters: {
visibility: 'public', published: true,
after, after,
}, },
order_by: 'rating_stat', order_by: 'rating_stat',
@ -206,9 +206,7 @@ const TOP_ARTICLES_COUNT = 10
export const loadTopArticles = async (): Promise<void> => { export const loadTopArticles = async (): Promise<void> => {
const options: LoadShoutsOptions = { const options: LoadShoutsOptions = {
filters: { filters: { published: true },
visibility: 'public',
},
order_by: 'rating_stat', order_by: 'rating_stat',
limit: TOP_ARTICLES_COUNT, limit: TOP_ARTICLES_COUNT,
} }