Skip to content

Commit

Permalink
urls.personByDistinctId
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusandra committed Oct 3, 2023
1 parent 39e962b commit 64f70b0
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export const commandPaletteLogic = kea<commandPaletteLogicType>({
display: `View person ${input}`,
executor: () => {
const { push } = router.actions
push(urls.personDistinctId(person.distinct_ids[0]))
push(urls.personByDistinctId(person.distinct_ids[0]))
},
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function redirectOnSelectItems(
} else if (groupType === TaxonomicFilterGroupType.Cohorts) {
router.actions.push(urls.cohort(value))
} else if (groupType === TaxonomicFilterGroupType.Persons) {
router.actions.push(urls.personDistinctId(String(value)))
router.actions.push(urls.personByDistinctId(String(value)))
} else if (groupType.startsWith(TaxonomicFilterGroupType.GroupNamesPrefix)) {
router.actions.push(urls.group((item as Group).group_type_index, String(value)))
} else if (groupType === TaxonomicFilterGroupType.Insights) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/queries/nodes/DataTable/renderColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export function renderColumn(
} else if (key === 'person' && isPersonsNode(query.source)) {
const personRecord = record as PersonType
return (
<Link to={urls.personDistinctId(personRecord.distinct_ids[0])}>
<Link to={urls.personByDistinctId(personRecord.distinct_ids[0])}>
<PersonDisplay noLink withIcon person={personRecord} noPopover />
</Link>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,13 @@ const WARNING_TYPE_RENDERER = {
return (
<>
Refused to merge already identified person{' '}
<Link to={urls.personDistinctId(details.sourcePersonDistinctId)}>{details.sourcePersonDistinctId}</Link>{' '}
<Link to={urls.personByDistinctId(details.sourcePersonDistinctId)}>
{details.sourcePersonDistinctId}
</Link>{' '}
into{' '}
<Link to={urls.personDistinctId(details.targetPersonDistinctId)}>{details.targetPersonDistinctId}</Link>{' '}
<Link to={urls.personByDistinctId(details.targetPersonDistinctId)}>
{details.targetPersonDistinctId}
</Link>{' '}
via an $identify or $create_alias call (event uuid: <code>{details.eventUuid}</code>).
</>
)
Expand All @@ -52,8 +56,8 @@ const WARNING_TYPE_RENDERER = {
return (
<>
Refused to merge an illegal distinct_id{' '}
<Link to={urls.personDistinctId(details.illegalDistinctId)}>{details.illegalDistinctId}</Link> with{' '}
<Link to={urls.personDistinctId(details.otherDistinctId)}>{details.otherDistinctId}</Link> via an
<Link to={urls.personByDistinctId(details.illegalDistinctId)}>{details.illegalDistinctId}</Link> with{' '}
<Link to={urls.personByDistinctId(details.otherDistinctId)}>{details.otherDistinctId}</Link> via an
$identify or $create_alias call (event uuid: <code>{details.eventUuid}</code>).
</>
)
Expand Down Expand Up @@ -117,8 +121,8 @@ const WARNING_TYPE_RENDERER = {
return (
<>
Event ingestion has overflowed capacity for distinct_id{' '}
<Link to={urls.personDistinctId(details.overflowDistinctId)}>{details.overflowDistinctId}</Link>. Events
will still be processed, but are likely to be delayed longer than usual.
<Link to={urls.personByDistinctId(details.overflowDistinctId)}>{details.overflowDistinctId}</Link>.
Events will still be processed, but are likely to be delayed longer than usual.
</>
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function backlinkHref(id: string, type: TaxonomicFilterGroupType): string {
} else if (type === TaxonomicFilterGroupType.Cohorts) {
return urls.cohort(id)
} else if (type === TaxonomicFilterGroupType.Persons) {
return urls.personDistinctId(id)
return urls.personByDistinctId(id)
} else if (type === TaxonomicFilterGroupType.Insights) {
return urls.insightView(id as InsightModel['short_id'])
} else if (type === TaxonomicFilterGroupType.FeatureFlags) {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/scenes/notebooks/Nodes/NotebookNodePerson.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ export const NotebookNodePerson = createPostHogWidgetNode<NotebookNodePersonAttr
Component,
heightEstimate: 300,
minHeight: 100,
href: (attrs) => urls.personDistinctId(attrs.id),
href: (attrs) => urls.personByDistinctId(attrs.id),
resizeable: true,
attributes: {
id: {},
},
pasteOptions: {
find: urls.personDistinctId('(.+)', false),
find: urls.personByDistinctId('(.+)', false),
getAttributes: async (match) => {
return { id: match[1] }
},
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/scenes/persons/PersonPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function PersonPreview(props: PersonPreviewProps): JSX.Element | null {
}

const display = asDisplay(person)
const url = urls.personDistinctId(person?.distinct_ids[0])
const url = urls.personByDistinctId(person?.distinct_ids[0])

return (
<div className="flex flex-col overflow-hidden max-h-80 max-w-160 gap-2">
Expand All @@ -54,7 +54,7 @@ export function PersonPreview(props: PersonPreviewProps): JSX.Element | null {
<LemonButton
size="small"
icon={<IconOpenInNew />}
to={urls.personDistinctId(person?.distinct_ids[0])}
to={urls.personByDistinctId(person?.distinct_ids[0])}
/>
</div>

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/scenes/persons/PersonScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export function PersonScene(): JSX.Element | null {
return personLoading ? <SpinnerOverlay sceneLevel /> : <NotFound object="Person" />
}

const url = urls.personDistinctId(urlId || person.distinct_ids[0] || String(person.id))
const url = urls.personByDistinctId(urlId || person.distinct_ids[0] || String(person.id))

return (
<>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/scenes/persons/activityDescriptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export function personActivityDescriber(logItem: ActivityLogItem): HumanizedChan
}
listParts={distinctIds.map((di) => (
<span key={di} className="highlighted-activity">
<Link to={urls.personDistinctId(di)}>{di}</Link>
<Link to={urls.personByDistinctId(di)}>{di}</Link>
</span>
))}
/>
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/scenes/persons/person-utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { asLink, asDisplay } from './person-utils'
describe('the person header', () => {
describe('linking to a person', () => {
const personLinksTestCases = [
{ distinctIds: ['a uuid'], expectedLink: urls.personDistinctId('a uuid'), name: 'with one id' },
{ distinctIds: ['a uuid'], expectedLink: urls.personByDistinctId('a uuid'), name: 'with one id' },
{
distinctIds: ['the first uuid', 'a uuid'],
expectedLink: urls.personDistinctId('the first uuid'),
expectedLink: urls.personByDistinctId('the first uuid'),
name: 'with more than one id',
},
{
Expand All @@ -19,7 +19,7 @@ describe('the person header', () => {
},
{
distinctIds: ['a+dicey/@!'],
expectedLink: urls.personDistinctId('a+dicey/@!'),
expectedLink: urls.personByDistinctId('a+dicey/@!'),
name: 'with no ids',
},
]
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/scenes/persons/person-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function asDisplay(person: PersonPropType | null | undefined, maxLength?:

export const asLink = (person?: PersonPropType | null): string | undefined =>
person?.distinct_id
? urls.personDistinctId(person.distinct_id)
? urls.personByDistinctId(person.distinct_id)
: person?.distinct_ids?.length
? urls.personDistinctId(person.distinct_ids[0])
? urls.personByDistinctId(person.distinct_ids[0])
: undefined
2 changes: 1 addition & 1 deletion frontend/src/scenes/project-homepage/NewlySeenPersons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function PersonRow({ person }: { person: PersonType }): JSX.Element {

return (
<ProjectHomePageCompactListItem
to={urls.personDistinctId(person.distinct_ids[0])}
to={urls.personByDistinctId(person.distinct_ids[0])}
title={asDisplay(person)}
subtitle={`First seen ${dayjs(person.created_at).fromNow()}`}
prefix={<ProfilePicture name={asDisplay(person)} />}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/scenes/retention/RetentionModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export function RetentionModal(): JSX.Element | null {
) : (
<LemonButton
size="small"
to={urls.personDistinctId(
to={urls.personByDistinctId(
personAppearances.person.distinct_ids[0]
)}
data-attr="retention-person-link"
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/scenes/scenes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ export const routes: Record<string, Scene> = {
}, {} as Record<string, Scene>),
[urls.replaySingle(':id')]: Scene.ReplaySingle,
[urls.replayPlaylist(':id')]: Scene.ReplayPlaylist,
[urls.personDistinctId('*', false)]: Scene.Person,
[urls.personByDistinctId('*', false)]: Scene.Person,
[urls.persons()]: Scene.Persons,
[urls.groups(':groupTypeIndex')]: Scene.Groups,
[urls.group(':groupTypeIndex', ':groupKey', false)]: Scene.Group,
Expand Down

0 comments on commit 64f70b0

Please sign in to comment.