From 64f70b028bbdce1f8b03ad8f7b30bdd7ebcff098 Mon Sep 17 00:00:00 2001 From: Marius Andra Date: Tue, 3 Oct 2023 15:49:44 +0200 Subject: [PATCH] urls.personByDistinctId --- .../CommandPalette/commandPaletteLogic.tsx | 2 +- .../UniversalSearch/UniversalSearchPopover.tsx | 2 +- .../src/queries/nodes/DataTable/renderColumn.tsx | 2 +- .../ingestion-warnings/IngestionWarningsView.tsx | 16 ++++++++++------ .../notebooks/Nodes/NotebookNodeBacklink.tsx | 2 +- .../notebooks/Nodes/NotebookNodePerson.tsx | 4 ++-- frontend/src/scenes/persons/PersonPreview.tsx | 4 ++-- frontend/src/scenes/persons/PersonScene.tsx | 2 +- .../src/scenes/persons/activityDescriptions.tsx | 2 +- frontend/src/scenes/persons/person-utils.test.ts | 6 +++--- frontend/src/scenes/persons/person-utils.ts | 4 ++-- .../scenes/project-homepage/NewlySeenPersons.tsx | 2 +- frontend/src/scenes/retention/RetentionModal.tsx | 2 +- frontend/src/scenes/scenes.ts | 2 +- 14 files changed, 28 insertions(+), 24 deletions(-) diff --git a/frontend/src/lib/components/CommandPalette/commandPaletteLogic.tsx b/frontend/src/lib/components/CommandPalette/commandPaletteLogic.tsx index 8afea17e7a639..285d1baa5c51d 100644 --- a/frontend/src/lib/components/CommandPalette/commandPaletteLogic.tsx +++ b/frontend/src/lib/components/CommandPalette/commandPaletteLogic.tsx @@ -246,7 +246,7 @@ export const commandPaletteLogic = kea({ display: `View person ${input}`, executor: () => { const { push } = router.actions - push(urls.personDistinctId(person.distinct_ids[0])) + push(urls.personByDistinctId(person.distinct_ids[0])) }, }, ], diff --git a/frontend/src/lib/components/UniversalSearch/UniversalSearchPopover.tsx b/frontend/src/lib/components/UniversalSearch/UniversalSearchPopover.tsx index 6784cf0e30e5b..cbacb2ef845b3 100644 --- a/frontend/src/lib/components/UniversalSearch/UniversalSearchPopover.tsx +++ b/frontend/src/lib/components/UniversalSearch/UniversalSearchPopover.tsx @@ -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) { diff --git a/frontend/src/queries/nodes/DataTable/renderColumn.tsx b/frontend/src/queries/nodes/DataTable/renderColumn.tsx index 9b43efe3dec96..88b749007301e 100644 --- a/frontend/src/queries/nodes/DataTable/renderColumn.tsx +++ b/frontend/src/queries/nodes/DataTable/renderColumn.tsx @@ -205,7 +205,7 @@ export function renderColumn( } else if (key === 'person' && isPersonsNode(query.source)) { const personRecord = record as PersonType return ( - + ) diff --git a/frontend/src/scenes/data-management/ingestion-warnings/IngestionWarningsView.tsx b/frontend/src/scenes/data-management/ingestion-warnings/IngestionWarningsView.tsx index 42702b26752e4..b7c4abb20d8c2 100644 --- a/frontend/src/scenes/data-management/ingestion-warnings/IngestionWarningsView.tsx +++ b/frontend/src/scenes/data-management/ingestion-warnings/IngestionWarningsView.tsx @@ -36,9 +36,13 @@ const WARNING_TYPE_RENDERER = { return ( <> Refused to merge already identified person{' '} - {details.sourcePersonDistinctId}{' '} + + {details.sourcePersonDistinctId} + {' '} into{' '} - {details.targetPersonDistinctId}{' '} + + {details.targetPersonDistinctId} + {' '} via an $identify or $create_alias call (event uuid: {details.eventUuid}). ) @@ -52,8 +56,8 @@ const WARNING_TYPE_RENDERER = { return ( <> Refused to merge an illegal distinct_id{' '} - {details.illegalDistinctId} with{' '} - {details.otherDistinctId} via an + {details.illegalDistinctId} with{' '} + {details.otherDistinctId} via an $identify or $create_alias call (event uuid: {details.eventUuid}). ) @@ -117,8 +121,8 @@ const WARNING_TYPE_RENDERER = { return ( <> Event ingestion has overflowed capacity for distinct_id{' '} - {details.overflowDistinctId}. Events - will still be processed, but are likely to be delayed longer than usual. + {details.overflowDistinctId}. + Events will still be processed, but are likely to be delayed longer than usual. ) }, diff --git a/frontend/src/scenes/notebooks/Nodes/NotebookNodeBacklink.tsx b/frontend/src/scenes/notebooks/Nodes/NotebookNodeBacklink.tsx index be439a0a4f184..fa8a0b818484c 100644 --- a/frontend/src/scenes/notebooks/Nodes/NotebookNodeBacklink.tsx +++ b/frontend/src/scenes/notebooks/Nodes/NotebookNodeBacklink.tsx @@ -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) { diff --git a/frontend/src/scenes/notebooks/Nodes/NotebookNodePerson.tsx b/frontend/src/scenes/notebooks/Nodes/NotebookNodePerson.tsx index f653730c70e9c..ba9270a42d3f6 100644 --- a/frontend/src/scenes/notebooks/Nodes/NotebookNodePerson.tsx +++ b/frontend/src/scenes/notebooks/Nodes/NotebookNodePerson.tsx @@ -94,13 +94,13 @@ export const NotebookNodePerson = createPostHogWidgetNode 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] } }, diff --git a/frontend/src/scenes/persons/PersonPreview.tsx b/frontend/src/scenes/persons/PersonPreview.tsx index 94ce122999243..7b9e61fe377aa 100644 --- a/frontend/src/scenes/persons/PersonPreview.tsx +++ b/frontend/src/scenes/persons/PersonPreview.tsx @@ -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 (
@@ -54,7 +54,7 @@ export function PersonPreview(props: PersonPreviewProps): JSX.Element | null { } - to={urls.personDistinctId(person?.distinct_ids[0])} + to={urls.personByDistinctId(person?.distinct_ids[0])} />
diff --git a/frontend/src/scenes/persons/PersonScene.tsx b/frontend/src/scenes/persons/PersonScene.tsx index 10717c1226ab6..e6c7a1036bc05 100644 --- a/frontend/src/scenes/persons/PersonScene.tsx +++ b/frontend/src/scenes/persons/PersonScene.tsx @@ -127,7 +127,7 @@ export function PersonScene(): JSX.Element | null { return personLoading ? : } - 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 ( <> diff --git a/frontend/src/scenes/persons/activityDescriptions.tsx b/frontend/src/scenes/persons/activityDescriptions.tsx index f8dd95127a9d9..f11568827c9dd 100644 --- a/frontend/src/scenes/persons/activityDescriptions.tsx +++ b/frontend/src/scenes/persons/activityDescriptions.tsx @@ -68,7 +68,7 @@ export function personActivityDescriber(logItem: ActivityLogItem): HumanizedChan } listParts={distinctIds.map((di) => ( - {di} + {di} ))} /> diff --git a/frontend/src/scenes/persons/person-utils.test.ts b/frontend/src/scenes/persons/person-utils.test.ts index 8ef3525afd219..2baca39945f4b 100644 --- a/frontend/src/scenes/persons/person-utils.test.ts +++ b/frontend/src/scenes/persons/person-utils.test.ts @@ -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', }, { @@ -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', }, ] diff --git a/frontend/src/scenes/persons/person-utils.ts b/frontend/src/scenes/persons/person-utils.ts index 74208b4079fa3..35928473b08be 100644 --- a/frontend/src/scenes/persons/person-utils.ts +++ b/frontend/src/scenes/persons/person-utils.ts @@ -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 diff --git a/frontend/src/scenes/project-homepage/NewlySeenPersons.tsx b/frontend/src/scenes/project-homepage/NewlySeenPersons.tsx index 221d7938549c4..0aea88331c5e3 100644 --- a/frontend/src/scenes/project-homepage/NewlySeenPersons.tsx +++ b/frontend/src/scenes/project-homepage/NewlySeenPersons.tsx @@ -17,7 +17,7 @@ function PersonRow({ person }: { person: PersonType }): JSX.Element { return ( } diff --git a/frontend/src/scenes/retention/RetentionModal.tsx b/frontend/src/scenes/retention/RetentionModal.tsx index 621f7da33fcde..b47409b554953 100644 --- a/frontend/src/scenes/retention/RetentionModal.tsx +++ b/frontend/src/scenes/retention/RetentionModal.tsx @@ -110,7 +110,7 @@ export function RetentionModal(): JSX.Element | null { ) : ( = { }, {} as Record), [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,