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

Function getPostReadTarget

packages/shared/src/graphql/posts.ts:107–123  ·  view source on GitHub ↗
(
  post: T,
)

Source from the content-addressed store, hash-verified

105 * to the shared post when available.
106 */
107export const getPostReadTarget = <
108 T extends Pick<Post, 'type' | 'subType' | 'sharedPost'> &
109 Partial<Pick<Post, 'id'>>,
110>(
111 post: T,
112): { target: T | Post['sharedPost']; parentId?: string } => {
113 const isSocialQuote = isSocialTwitterPost(post) && !!post.sharedPost;
114
115 if (isSocialQuote) {
116 return { target: post };
117 }
118
119 return {
120 target: post.sharedPost || post,
121 parentId: post.sharedPost ? post.id : undefined,
122 };
123};
124
125/**
126 * Resolve the external URL the "Read post" affordance should navigate to.

Callers 2

useReadArticleFunction · 0.90
getReadArticleHrefFunction · 0.85

Calls 1

isSocialTwitterPostFunction · 0.85

Tested by

no test coverage detected