diff --git a/src/components/PostControls/PostMenu/PostMenuControlItems.tsx b/src/components/PostControls/PostMenu/PostMenuControlItems.tsx index 3101a8135..31ff1b2c5 100644 --- a/src/components/PostControls/PostMenu/PostMenuControlItems.tsx +++ b/src/components/PostControls/PostMenu/PostMenuControlItems.tsx @@ -1,9 +1,8 @@ -import {AtUri} from '@atproto/syntax' import {useLingui} from '@lingui/react/macro' import {useHaptics} from '#/lib/haptics' import {useOpenComposer} from '#/lib/hooks/useOpenComposer' -import {makeProfileLink} from '#/lib/routes/links' +import {postPermalink} from '#/lib/routes/links' import {shareUrl} from '#/lib/sharing' import {toShareUrl} from '#/lib/strings/url-helpers' import {type Shadow} from '#/state/cache/post-shadow' @@ -144,8 +143,7 @@ export function PostMenuControlItems({ } else { ax.metric('share:press:nativeShare', {}) } - const {rkey} = new AtUri(post.uri) - void shareUrl(toShareUrl(makeProfileLink(post.author, 'post', rkey))) + void shareUrl(toShareUrl(postPermalink(post.author, post.uri))) sendInteraction({ item: post.uri, event: 'app.bsky.feed.defs#interactionShare', diff --git a/src/screens/PostThread/components/LikesStat.tsx b/src/screens/PostThread/components/LikesStat.tsx index 7d8c4949e..d78f02106 100644 --- a/src/screens/PostThread/components/LikesStat.tsx +++ b/src/screens/PostThread/components/LikesStat.tsx @@ -1,7 +1,6 @@ -import {AtUri} from '@atproto/syntax' import {Plural, Trans, useLingui} from '@lingui/react/macro' -import {makeProfileLink} from '#/lib/routes/links' +import {postPermalink} from '#/lib/routes/links' import {atoms as a, useTheme} from '#/alf' import {Link} from '#/components/Link' import {useFormatPostStatCount} from '#/components/PostControls/util' @@ -29,9 +28,7 @@ export function LikesStat({ const likeCount = post.likeCount ?? 0 if (likeCount === 0) return null - const likesHref = - href ?? - makeProfileLink(post.author, 'post', new AtUri(post.uri).rkey, 'liked-by') + const likesHref = href ?? postPermalink(post.author, post.uri, 'liked-by') return ( { - const urip = new AtUri(uri) - const link = makeProfileLink( - {did: urip.hostname, handle: ''}, - 'post', - urip.rkey, - ) - const isCommunity = urip.collection === 'community.blacksky.feed.post' - return isCommunity ? `${link}?collection=${urip.collection}` : link + // Covers community collections and permissioned-space record URIs. + return postUriToRelativePath(uri) ?? '' }, [uri]) const {t: l} = useLingui()