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

Function getPostReadTarget

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

Source from the content-addressed store, hash-verified

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

Callers 3

useReadArticleFunction · 0.90
getReadArticleHrefFunction · 0.85

Calls 1

isSocialTwitterPostFunction · 0.85

Tested by

no test coverage detected