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

Function getPostReadTarget

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

Source from the content-addressed store, hash-verified

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