Merge pull request #785 from stackernews/773-fix-pins-prevent-post-show-up-in-feeds

Fix pinned items don't show up in home
This commit is contained in:
Keyan 2024-02-04 16:46:49 -06:00 committed by GitHub
commit 65cc1dbcc0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View File

@ -465,7 +465,8 @@ export default {
${whereClause(
subClause(sub, 3, 'Item', me),
muteClause(me),
'"Item"."pinId" IS NULL',
// in "home" (sub undefined), we want to show pinned items (but without the pin icon)
sub ? '"Item"."pinId" IS NULL' : '',
'"Item"."deletedAt" IS NULL',
'"Item"."parentId" IS NULL',
'"Item".bio = false',

View File

@ -45,11 +45,13 @@ export default function Items ({ ssrData, variables = {}, query, destructureData
return <Skeleton />
}
const isHome = !variables?.sub
return (
<>
<div className={styles.grid}>
{itemsWithPins.filter(filter).map((item, i) => (
<ListItem key={item.id} item={item} rank={rank && i + 1} siblingComments={variables.includeComments} pinnable={pins?.length > 0} />
<ListItem key={item.id} item={item} rank={rank && i + 1} siblingComments={variables.includeComments} pinnable={isHome ? false : pins?.length > 0} />
))}
</div>
<Foooter