MCPcopy Create free account
hub / github.com/dailydotdev/apps / isPostRead

Function isPostRead

packages/shared/src/graphql/posts.ts:1757–1766  ·  view source on GitHub ↗
(
  post: Pick<Post, 'read' | 'bookmarked'> & { bookmark?: { read?: boolean } },
)

Source from the content-addressed store, hash-verified

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

Callers 7

BookmarkRowFunction · 0.90
EmbeddedTweetPreviewFunction · 0.90
ShareList.tsxFile · 0.90
getPostClassNamesFunction · 0.90
ArticleList.tsxFile · 0.90
PollList.tsxFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected