fix: show related items on pinned items (#1157)

* fix: show related items on pinned items

* fix condition

* use subName since sub could be undefined

* Update components/item-full.js

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Revert "Update components/item-full.js"

This reverts commit d1b785b8490c9356548ef1bfe246ae526f0237c6.

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Abhi Shandilya 2024-05-11 21:41:59 -04:00 committed by GitHub
parent 0c7ff80fb8
commit 0fda8907e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -161,7 +161,19 @@ function TopLevelItem ({ item, noReply, ...props }) {
{!noReply && {!noReply &&
<> <>
<Reply item={item} replyOpen placeholder={item.ncomments > 3 ? 'fractions of a penny for your thoughts?' : 'early comments get more zaps'} onCancelQuote={cancelQuote} onQuoteReply={quoteReply} quote={quote} /> <Reply item={item} replyOpen placeholder={item.ncomments > 3 ? 'fractions of a penny for your thoughts?' : 'early comments get more zaps'} onCancelQuote={cancelQuote} onQuoteReply={quoteReply} quote={quote} />
{!item.position && !item.isJob && !item.parentId && !item.deletedAt && !(item.bounty > 0) && <Related title={item.title} itemId={item.id} show={item.ncomments === 0} />} {
// Don't show related items for Saloon items (position is set but no subName)
(!item.position && item.subName) &&
// Don't show related items for jobs
!item.isJob &&
// Don't show related items for child items
!item.parentId &&
// Don't show related items for deleted items
!item.deletedAt &&
// Don't show related items for items with bounties, show past bounties instead
!(item.bounty > 0) &&
<Related title={item.title} itemId={item.id} show={item.ncomments === 0} />
}
{item.bounty > 0 && <PastBounties item={item} />} {item.bounty > 0 && <PastBounties item={item} />}
</>} </>}
</ItemComponent> </ItemComponent>