Link to profile via handle vs did (#10012)
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
|||||||
import {useLingui} from '@lingui/react/macro'
|
import {useLingui} from '@lingui/react/macro'
|
||||||
|
|
||||||
import {getModerationCauseKey} from '#/lib/moderation'
|
import {getModerationCauseKey} from '#/lib/moderation'
|
||||||
|
import {makeProfileLink} from '#/lib/routes/links'
|
||||||
import {forceLTR} from '#/lib/strings/bidi'
|
import {forceLTR} from '#/lib/strings/bidi'
|
||||||
import {NON_BREAKING_SPACE} from '#/lib/strings/constants'
|
import {NON_BREAKING_SPACE} from '#/lib/strings/constants'
|
||||||
import {sanitizeDisplayName} from '#/lib/strings/display-names'
|
import {sanitizeDisplayName} from '#/lib/strings/display-names'
|
||||||
@@ -138,15 +139,17 @@ export function Link({
|
|||||||
} & Omit<LinkProps, 'to' | 'label'>) {
|
} & Omit<LinkProps, 'to' | 'label'>) {
|
||||||
const {t: l} = useLingui()
|
const {t: l} = useLingui()
|
||||||
|
|
||||||
|
const profileURL = makeProfileLink({
|
||||||
|
did: profile.did,
|
||||||
|
handle: profile.handle,
|
||||||
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<InternalLink
|
<InternalLink
|
||||||
label={l`View ${
|
label={l`View ${
|
||||||
profile.displayName || sanitizeHandle(profile.handle)
|
profile.displayName || sanitizeHandle(profile.handle)
|
||||||
}’s profile`}
|
}’s profile`}
|
||||||
to={{
|
to={profileURL}
|
||||||
screen: 'Profile',
|
|
||||||
params: {name: profile.did},
|
|
||||||
}}
|
|
||||||
style={[a.flex_col, style]}
|
style={[a.flex_col, style]}
|
||||||
{...rest}>
|
{...rest}>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
Reference in New Issue
Block a user