(
post: Pick<Post, 'read' | 'bookmarked'> & { bookmark?: { read?: boolean } },
)
| 1753 | * unread shows on the card. Anything else is read once it was viewed. |
| 1754 | */ |
| 1755 | export const isPostRead = ( |
| 1756 | post: Pick<Post, 'read' | 'bookmarked'> & { bookmark?: { read?: boolean } }, |
| 1757 | ): boolean => { |
| 1758 | // Removing a bookmark leaves its object in the cache, so `bookmarked` says |
| 1759 | // whether it still speaks for the post |
| 1760 | const bookmarkRead = |
| 1761 | post.bookmarked === false ? undefined : post.bookmark?.read; |
| 1762 | |
| 1763 | return bookmarkRead ?? !!post.read; |
| 1764 | }; |
| 1765 | |
| 1766 | /** |
| 1767 | * The cache patch for an opened post. A bookmark keeps its own read flag, so |
no outgoing calls
no test coverage detected