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

Function getPostReadTarget

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

Source from the content-addressed store, hash-verified

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