(
post: Pick<Post, 'read' | 'bookmarked'> & { bookmark?: { read?: boolean } },
)
| 1728 | * unread shows on the card. Anything else is read once it was viewed. |
| 1729 | */ |
| 1730 | export const isPostRead = ( |
| 1731 | post: Pick<Post, 'read' | 'bookmarked'> & { bookmark?: { read?: boolean } }, |
| 1732 | ): boolean => { |
| 1733 | // Removing a bookmark leaves its object in the cache, so `bookmarked` says |
| 1734 | // whether it still speaks for the post |
| 1735 | const bookmarkRead = |
| 1736 | post.bookmarked === false ? undefined : post.bookmark?.read; |
| 1737 | |
| 1738 | return bookmarkRead ?? !!post.read; |
| 1739 | }; |
| 1740 | |
| 1741 | /** |
| 1742 | * The cache patch for an opened post. A bookmark keeps its own read flag, so |
no outgoing calls
no test coverage detected