( post: T, )
| 105 | * to the shared post when available. |
| 106 | */ |
| 107 | export 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. |
no test coverage detected