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

Function isPostRead

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

Source from the content-addressed store, hash-verified

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

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