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

Function isPostRead

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

Source from the content-addressed store, hash-verified

1753 * unread shows on the card. Anything else is read once it was viewed.
1754 */
1755export 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

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