Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(activity-log): show the actor's email on hover (#97805)

James Gillda65c25f3d1f
diff --git a/frontend/src/lib/components/ActivityLog/ActivityLog.tsx b/frontend/src/lib/components/ActivityLog/ActivityLog.tsx
index 3b8245df09c4..63c9c50ede1a 100644
--- a/frontend/src/lib/components/ActivityLog/ActivityLog.tsx
+++ b/frontend/src/lib/components/ActivityLog/ActivityLog.tsx
@@ -178,15 +178,27 @@ export const ActivityLogRow = ({
<div
className={clsx('ActivityLogRow flex deprecated-space-x-2', logItem.unread && 'ActivityLogRow--unread')}
>
- <ProfilePicture
- showName={false}
- user={{
- first_name: logItem.isSystem || logItem.wasImpersonated ? logItem.name : undefined,
- email: logItem.email ?? undefined,
- }}
- type={logItem.isSystem || logItem.wasImpersonated ? 'system' : 'person'}
- size="xl"
- />
+ {/* Tooltip merges the trigger props onto its child element, and ProfilePicture drops props
+ it does not declare, so the trigger must land on the span instead of the avatar. */}
+ <Tooltip
+ title={
+ logItem.emailToReveal ? (
+ <span className="ph-no-capture">{logItem.emailToReveal}</span>
+ ) : undefined
+ }
+ >
+ <span className="flex shrink-0">
+ <ProfilePicture
+ showName={false}
+ user={{
+ first_name: logItem.isSystem || logItem.wasImpersonated ? logItem.name : undefined,
+ email: logItem.email ?? undefined,
+ }}
+ type={logItem.isSystem || logItem.wasImpersonated ? 'system' : 'person'}
+ size="xl"
+ />
+ </span>
+ </Tooltip>
<div className="ActivityLogRow__details flex-grow">
<div className="ActivityLogRow__description">{logItem.description}</div>
{logItem.extendedDescription && (
diff --git a/frontend/src/lib/components/ActivityLog/UserNameWithEmail.tsx b/frontend/src/lib/components/ActivityLog/UserNameWithEmail.tsx
new file mode 100644
index 000000000000..1836b87e2261
--- /dev/null
+++ b/frontend/src/lib/components/ActivityLog/UserNameWithEmail.tsx
@@ -0,0 +1,17 @@
+import { Tooltip } from 'lib/lemon-ui/Tooltip'
+
+/**
+ * A person's name in an activity log line, with their email on hover. Organizations often have
+ * several members who share a first name, and many accounts carry no last name, so the name alone
+ * can be ambiguous. Callers pass no email when the row must not disclose one.
+ */
+export function UserNameWithEmail({ name, email }: { name: string; email?: string | null }): JSX.Element {
+ if (!email || email === name) {
+ return <strong className="ph-no-capture">{name}</strong>
+ }
+ return (
+ <Tooltip title={<span className="ph-no-capture">{email}</span>}>
+ <strong className="ph-no-capture cursor-help">{name}</strong>
+ </Tooltip>
+ )
+}
diff --git a/frontend/src/lib/components/ActivityLog/activityDescriptions/instanceSettingActivityDescriber.tsx b/frontend/src/lib/components/ActivityLog/activityDescriptions/instanceSettingActivityDescriber.tsx
index c421f4c1c139..40a94f18bfcf 100644
--- a/frontend/src/lib/components/ActivityLog/activityDescriptions/instanceSettingActivityDescriber.tsx
+++ b/frontend/src/lib/components/ActivityLog/activityDescriptions/instanceSettingActivityDescriber.tsx
@@ -1,9 +1,9 @@
import {
ActivityLogItem,
+ ActivityLogUserName,
Describer,
HumanizedChange,
defaultDescriber,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
import { ActivityScope } from '~/types'
@@ -46,7 +46,7 @@ export const instanceSettingActivityDescriber: Describer = (
const key = change.field || logItem.detail.name || 'unknown setting'
const transition = describeSecretTransition(change.before, change.after)
- const actor = <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>
+ const actor = <ActivityLogUserName logItem={logItem} />
if (transition) {
return {
diff --git a/frontend/src/lib/components/ActivityLog/activityDescriptions/tagActivityDescriber.tsx b/frontend/src/lib/components/ActivityLog/activityDescriptions/tagActivityDescriber.tsx
index 5726a78ca7df..fcef0bf7a784 100644
--- a/frontend/src/lib/components/ActivityLog/activityDescriptions/tagActivityDescriber.tsx
+++ b/frontend/src/lib/components/ActivityLog/activityDescriptions/tagActivityDescriber.tsx
@@ -1,8 +1,8 @@
import {
ActivityLogItem,
+ ActivityLogUserName,
HumanizedChange,
defaultDescriber,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'
import { Link } from 'lib/lemon-ui/Link'
@@ -107,7 +107,7 @@ export function tagActivityDescriber(logItem: ActivityLogItem, asNotification?:
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> created the tag{' '}
+ <ActivityLogUserName logItem={logItem} /> created the tag{' '}
<strong>{nameOrId(logItem?.detail?.name, logItem?.item_id)}</strong>
</>
),
@@ -118,7 +118,7 @@ export function tagActivityDescriber(logItem: ActivityLogItem, asNotification?:
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> deleted the tag{' '}
+ <ActivityLogUserName logItem={logItem} /> deleted the tag{' '}
<strong>{nameOrId(logItem?.detail?.name, logItem?.item_id)}</strong>
</>
),
@@ -129,7 +129,7 @@ export function tagActivityDescriber(logItem: ActivityLogItem, asNotification?:
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> updated the tag{' '}
+ <ActivityLogUserName logItem={logItem} /> updated the tag{' '}
<strong>{nameOrId(logItem?.detail?.name, logItem?.item_id)}</strong>
</>
),
@@ -149,8 +149,8 @@ function taggedItemActivityDescriber(logItem: ActivityLogItem, asNotification?:
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> tagged {relatedObjectDesc}{' '}
- with tag <strong>{tagName}</strong>
+ <ActivityLogUserName logItem={logItem} /> tagged {relatedObjectDesc} with tag{' '}
+ <strong>{tagName}</strong>
</>
),
}
@@ -160,8 +160,8 @@ function taggedItemActivityDescriber(logItem: ActivityLogItem, asNotification?:
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> removed tag{' '}
- <strong>{tagName}</strong> {relatedObjectDescFrom}
+ <ActivityLogUserName logItem={logItem} /> removed tag <strong>{tagName}</strong>{' '}
+ {relatedObjectDescFrom}
</>
),
}
diff --git a/frontend/src/lib/components/ActivityLog/humanizeActivity.test.tsx b/frontend/src/lib/components/ActivityLog/humanizeActivity.test.tsx
index 5bf8e4677363..a277add36c15 100644
--- a/frontend/src/lib/components/ActivityLog/humanizeActivity.test.tsx
+++ b/frontend/src/lib/components/ActivityLog/humanizeActivity.test.tsx
@@ -1,8 +1,10 @@
-import { ActivityLogItem, userNameForLogItem } from 'lib/components/ActivityLog/humanizeActivity'
+import { render } from '@testing-library/react'
+
+import { ActivityLogItem, ActivityLogUserName, userNameForLogItem } from 'lib/components/ActivityLog/humanizeActivity'
import { ActivityScope } from '~/types'
-describe('userNameForLogItem', () => {
+describe('humanizeActivity', () => {
const makeLogItem = (overrides: Partial<ActivityLogItem>): ActivityLogItem => ({
activity: 'updated',
created_at: '2026-06-04T00:00:00Z',
@@ -11,30 +13,75 @@ describe('userNameForLogItem', () => {
...overrides,
})
- it.each([
- [
- 'uses the full name when set',
- { user: { first_name: 'Ada', last_name: 'Lovelace', email: '[email protected]' } },
- 'Ada Lovelace',
- ],
- [
- 'falls back to email when the name is blank',
- { user: { first_name: '', last_name: '', email: '[email protected]' } },
- ],
- [
- 'falls back to the placeholder when name and email are both blank',
- { user: { first_name: '', last_name: '', email: '' } },
- 'A user',
- ],
- ['falls back to the placeholder when there is no user', {}, 'A user'],
- ['renders system activity as PostHog', { is_system: true }, 'PostHog'],
- [
- 'falls back to email for impersonated actors with a blank name',
- { was_impersonated: true, user: { first_name: '', last_name: '', email: '[email protected]' } },
- 'PostHog Support (as [email protected])',
- ],
- ])('%s', (_name, overrides: Partial<ActivityLogItem>, expected: string) => {
- expect(userNameForLogItem(makeLogItem(overrides))).toEqual(expected)
+ describe('userNameForLogItem', () => {
+ it.each([
+ [
+ 'uses the full name when set',
+ { user: { first_name: 'Ada', last_name: 'Lovelace', email: '[email protected]' } },
+ 'Ada Lovelace',
+ ],
+ [
+ 'falls back to email when the name is blank',
+ { user: { first_name: '', last_name: '', email: '[email protected]' } },
+ ],
+ [
+ 'falls back to the placeholder when name and email are both blank',
+ { user: { first_name: '', last_name: '', email: '' } },
+ 'A user',
+ ],
+ ['falls back to the placeholder when there is no user', {}, 'A user'],
+ ['renders system activity as PostHog', { is_system: true }, 'PostHog'],
+ [
+ 'falls back to email for impersonated actors with a blank name',
+ { was_impersonated: true, user: { first_name: '', last_name: '', email: '[email protected]' } },
+ 'PostHog Support (as [email protected])',
+ ],
+ ])('%s', (_name, overrides: Partial<ActivityLogItem>, expected: string) => {
+ expect(userNameForLogItem(makeLogItem(overrides))).toEqual(expected)
+ })
+ })
+
+ describe('ActivityLogUserName', () => {
+ // Base UI marks the element it merges the tooltip trigger onto. Opening the popup is not
+ // reliable in jsdom because of the hover delay, so assert on the trigger instead.
+ const renderName = (overrides: Partial<ActivityLogItem>): HTMLElement => {
+ const { container } = render(<ActivityLogUserName logItem={makeLogItem(overrides)} />)
+ const element = container.querySelector('strong')
+ if (!element) {
+ throw new Error('ActivityLogUserName rendered no name element')
+ }
+ return element
+ }
+
+ it.each([
+ [
+ 'offers the email when the name does not already show it',
+ { user: { first_name: 'Ada', last_name: 'Lovelace', email: '[email protected]' } },
+ true,
+ ],
+ [
+ 'stays plain when the visible name is already the email',
+ { user: { first_name: '', last_name: '', email: '[email protected]' } },
+ false,
+ ],
+ ['stays plain when the actor is the system', { is_system: true }, false],
+ [
+ 'stays plain when a staff member was impersonating the actor',
+ {
+ was_impersonated: true,
+ user: { first_name: 'Ada', last_name: 'Lovelace', email: '[email protected]' },
+ },
+ false,
+ ],
+ ['stays plain when there is no user', {}, false],
+ ])('%s', (_name, overrides: Partial<ActivityLogItem>, expectTooltip: boolean) => {
+ const element = renderName(overrides)
+ expect(element.hasAttribute('data-base-ui-tooltip-trigger')).toBe(expectTooltip)
+ // The only visual cue that the name is hoverable.
+ expect(element.classList.contains('cursor-help')).toBe(expectTooltip)
+ // Dropping this on either branch sends every actor name into session replay.
+ expect(element.classList.contains('ph-no-capture')).toBe(true)
+ })
})
})
diff --git a/frontend/src/lib/components/ActivityLog/humanizeActivity.tsx b/frontend/src/lib/components/ActivityLog/humanizeActivity.tsx
index 8b42a32947f7..8e1fb42dd460 100644
--- a/frontend/src/lib/components/ActivityLog/humanizeActivity.tsx
+++ b/frontend/src/lib/components/ActivityLog/humanizeActivity.tsx
@@ -1,3 +1,4 @@
+import { UserNameWithEmail } from 'lib/components/ActivityLog/UserNameWithEmail'
import { dayjs } from 'lib/dayjs'
import { LemonMarkdown } from 'lib/lemon-ui/LemonMarkdown'
import { fullName } from 'lib/utils/strings'
@@ -73,6 +74,8 @@ export type HumanizedChange = { description: Description | null; extendedDescrip
export type HumanizedActivityLogItem = {
id?: string
email?: string | null
+ /** The email to offer on hover, or null when the row already prints it as the actor's name. */
+ emailToReveal?: string | null
name?: string
isSystem?: boolean
wasImpersonated?: boolean
@@ -119,7 +122,8 @@ export function humanize(
const impersonatedUserName = logItem.user ? fullName(logItem.user) : undefined
logLines.push({
id: logItem.id,
- email: logItem.was_impersonated ? undefined : logItem.user?.email,
+ email: actorEmailForLogItem(logItem),
+ emailToReveal: actorEmailToRevealForLogItem(logItem),
name: logItem.was_impersonated
? `PostHog Support${impersonatedUserName ? ` (as ${impersonatedUserName})` : ''}`
: impersonatedUserName,
@@ -159,6 +163,29 @@ function nameOrEmailForUser(
return fullName(user) || user.email || fallback
}
+// An impersonated row names PostHog Support as the actor, so the address on it belongs to the
+// member who was impersonated and attributing it to Support would misread the audit trail. Every
+// surface that shows the email must use this, or a row can disclose it in one place and hide it
+// in another.
+export function actorEmailForLogItem(logItem: ActivityLogItem): string | null {
+ if (logItem.is_system || logItem.was_impersonated) {
+ return null
+ }
+ return logItem.user?.email ?? null
+}
+
+// Kept apart from actorEmailForLogItem because that one also feeds the Gravatar lookup, and a
+// member whose name is their email still has a Gravatar to show.
+export function actorEmailToRevealForLogItem(logItem: ActivityLogItem): string | null {
+ const email = actorEmailForLogItem(logItem)
+ return email && email !== userNameForLogItem(logItem) ? email : null
+}
+
+/** The person who did the thing, with their email on hover. */
+export function ActivityLogUserName({ logItem }: { logItem: ActivityLogItem }): JSX.Element {
+ return <UserNameWithEmail name={userNameForLogItem(logItem)} email={actorEmailForLogItem(logItem)} />
+}
+
const NO_PLURAL_SCOPES: ActivityScope[] = [ActivityScope.DATA_MANAGEMENT]
// Keep in sync with SCOPE_DISPLAY_NAMES in ee/hogai/context/activity_log/context.py
@@ -211,7 +238,7 @@ export function defaultDescriber(
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> deleted <b>{resource}</b>
+ <ActivityLogUserName logItem={logItem} /> deleted <b>{resource}</b>
</>
),
}
@@ -221,7 +248,7 @@ export function defaultDescriber(
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> created <b>{resource}</b>
+ <ActivityLogUserName logItem={logItem} /> created <b>{resource}</b>
</>
),
}
@@ -231,7 +258,7 @@ export function defaultDescriber(
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> restored <b>{resource}</b>
+ <ActivityLogUserName logItem={logItem} /> restored <b>{resource}</b>
</>
),
}
@@ -241,7 +268,7 @@ export function defaultDescriber(
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> updated <b>{resource}</b>
+ <ActivityLogUserName logItem={logItem} /> updated <b>{resource}</b>
</>
),
}
@@ -251,8 +278,7 @@ export function defaultDescriber(
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> copied <b>{resource}</b> to
- another project
+ <ActivityLogUserName logItem={logItem} /> copied <b>{resource}</b> to another project
</>
),
}
@@ -264,14 +290,13 @@ export function defaultDescriber(
if (logItem.scope === 'Comment') {
description = (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> replied to a{' '}
- {humanizeScope(logItem.scope, true)}
+ <ActivityLogUserName logItem={logItem} /> replied to a {humanizeScope(logItem.scope, true)}
</>
)
} else {
description = (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> commented
+ <ActivityLogUserName logItem={logItem} /> commented
{asNotification ? <> on a {humanizeScope(logItem.scope, true)}</> : null}
</>
)
diff --git a/frontend/src/scenes/actions/actionActivityDescriber.tsx b/frontend/src/scenes/actions/actionActivityDescriber.tsx
index f04e0cdc7153..56135009e1a7 100644
--- a/frontend/src/scenes/actions/actionActivityDescriber.tsx
+++ b/frontend/src/scenes/actions/actionActivityDescriber.tsx
@@ -1,12 +1,12 @@
import {
ActivityChange,
ActivityLogItem,
+ ActivityLogUserName,
ChangeMapping,
Description,
HumanizedChange,
defaultDescriber,
detectBoolean,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
import { SentenceList } from 'lib/components/ActivityLog/SentenceList'
import { ObjectTags } from 'lib/components/ObjectTags/ObjectTags'
@@ -166,8 +166,7 @@ export function actionActivityDescriber(logItem: ActivityLogItem, asNotification
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> created action{' '}
- {nameAndLink(logItem)}
+ <ActivityLogUserName logItem={logItem} /> created action {nameAndLink(logItem)}
</>
),
}
@@ -177,8 +176,7 @@ export function actionActivityDescriber(logItem: ActivityLogItem, asNotification
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> deleted action{' '}
- {nameAndLink(logItem)}
+ <ActivityLogUserName logItem={logItem} /> deleted action {nameAndLink(logItem)}
</>
),
}
@@ -214,7 +212,7 @@ export function actionActivityDescriber(logItem: ActivityLogItem, asNotification
description: (
<SentenceList
listParts={changes}
- prefix={<strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>}
+ prefix={<ActivityLogUserName logItem={logItem} />}
suffix={changeSuffix}
/>
),
diff --git a/frontend/src/scenes/annotations/activityDescriptions.tsx b/frontend/src/scenes/annotations/activityDescriptions.tsx
index f6bf6ebc9808..3cca919551da 100644
--- a/frontend/src/scenes/annotations/activityDescriptions.tsx
+++ b/frontend/src/scenes/annotations/activityDescriptions.tsx
@@ -1,8 +1,8 @@
import {
ActivityLogItem,
+ ActivityLogUserName,
HumanizedChange,
defaultDescriber,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
import { Link } from 'lib/lemon-ui/Link'
import { urls } from 'scenes/urls'
@@ -80,7 +80,7 @@ export function annotationActivityDescriber(logItem: ActivityLogItem, asNotifica
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> created the annotation "
+ <ActivityLogUserName logItem={logItem} /> created the annotation "
{nameOrLinkToAnnotation(logItem?.item_id, logItem?.detail.name)}"{contextDesc}
</>
),
@@ -99,8 +99,7 @@ export function annotationActivityDescriber(logItem: ActivityLogItem, asNotifica
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> deleted the annotation:{' '}
- {displayName}
+ <ActivityLogUserName logItem={logItem} /> deleted the annotation: {displayName}
{contextDesc}
</>
),
@@ -112,7 +111,7 @@ export function annotationActivityDescriber(logItem: ActivityLogItem, asNotifica
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> updated the annotation:{' '}
+ <ActivityLogUserName logItem={logItem} /> updated the annotation:{' '}
{nameOrLinkToAnnotation(logItem?.item_id, logItem?.detail.name)}
{contextDesc}
</>
diff --git a/frontend/src/scenes/authentication/shared/activityDescriptions.tsx b/frontend/src/scenes/authentication/shared/activityDescriptions.tsx
index 2a087b0d3494..6f7ce2ab2bd8 100644
--- a/frontend/src/scenes/authentication/shared/activityDescriptions.tsx
+++ b/frontend/src/scenes/authentication/shared/activityDescriptions.tsx
@@ -1,8 +1,8 @@
import {
ActivityLogItem,
+ ActivityLogUserName,
HumanizedChange,
defaultDescriber,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
export function userActivityDescriber(logItem: ActivityLogItem, asNotification?: boolean): HumanizedChange {
@@ -20,7 +20,7 @@ export function userActivityDescriber(logItem: ActivityLogItem, asNotification?:
return {
description: (
<>
- <strong>{userNameForLogItem(logItem)}</strong> logged in using {loginMethod}
+ <ActivityLogUserName logItem={logItem} /> logged in using {loginMethod}
{reauthSensitiveOps && <> (re-authenticated for sensitive operations)</>}
</>
),
@@ -31,7 +31,7 @@ export function userActivityDescriber(logItem: ActivityLogItem, asNotification?:
return {
description: (
<>
- <strong>{userNameForLogItem(logItem)}</strong> logged out
+ <ActivityLogUserName logItem={logItem} /> logged out
</>
),
}
diff --git a/frontend/src/scenes/billing/activityDescriptions.tsx b/frontend/src/scenes/billing/activityDescriptions.tsx
index b6336d182d67..c700211a0fc2 100644
--- a/frontend/src/scenes/billing/activityDescriptions.tsx
+++ b/frontend/src/scenes/billing/activityDescriptions.tsx
@@ -1,9 +1,9 @@
import {
ActivityChange,
ActivityLogItem,
- defaultDescriber,
+ ActivityLogUserName,
HumanizedChange,
- userNameForLogItem,
+ defaultDescriber,
} from 'lib/components/ActivityLog/humanizeActivity'
import { Link } from 'lib/lemon-ui/Link'
import { urls } from 'scenes/urls'
@@ -62,7 +62,7 @@ export function billingActivityDescriber(logItem: ActivityLogItem, asNotificatio
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> {action} in{' '}
+ <ActivityLogUserName logItem={logItem} /> {action} in{' '}
<Link to={urls.organizationBilling()}>billing</Link>
{detail ? ` (${detail})` : ''}
</>
diff --git a/frontend/src/scenes/cohorts/activityDescriptions.tsx b/frontend/src/scenes/cohorts/activityDescriptions.tsx
index 23580c469476..9b46f5d2fd39 100644
--- a/frontend/src/scenes/cohorts/activityDescriptions.tsx
+++ b/frontend/src/scenes/cohorts/activityDescriptions.tsx
@@ -1,12 +1,12 @@
import {
ActivityChange,
ActivityLogItem,
+ ActivityLogUserName,
ChangeMapping,
Description,
HumanizedChange,
defaultDescriber,
detectBoolean,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
import { SentenceList } from 'lib/components/ActivityLog/SentenceList'
import { Link } from 'lib/lemon-ui/Link'
@@ -109,7 +109,7 @@ export function cohortActivityDescriber(logItem: ActivityLogItem, asNotification
return { description: null }
}
- const actor = <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>
+ const actor = <ActivityLogUserName logItem={logItem} />
const cohortLink = nameOrLinkToCohort(logItem?.item_id, logItem?.detail.name)
if (logItem.activity == 'created') {
diff --git a/frontend/src/scenes/dashboard/dashboardActivityDescriber.tsx b/frontend/src/scenes/dashboard/dashboardActivityDescriber.tsx
index 45adbff53878..fcb1e75630bc 100644
--- a/frontend/src/scenes/dashboard/dashboardActivityDescriber.tsx
+++ b/frontend/src/scenes/dashboard/dashboardActivityDescriber.tsx
@@ -10,12 +10,12 @@ import {
import {
ActivityChange,
ActivityLogItem,
+ ActivityLogUserName,
ChangeMapping,
Description,
HumanizedChange,
defaultDescriber,
detectBoolean,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
import { SentenceList } from 'lib/components/ActivityLog/SentenceList'
import {
@@ -199,8 +199,7 @@ export function dashboardActivityDescriber(logItem: ActivityLogItem, asNotificat
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> created the dashboard{' '}
- {nameAndLink(logItem)}
+ <ActivityLogUserName logItem={logItem} /> created the dashboard {nameAndLink(logItem)}
</>
),
}
@@ -249,7 +248,7 @@ export function dashboardActivityDescriber(logItem: ActivityLogItem, asNotificat
description: (
<SentenceList
listParts={changes}
- prefix={<strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>}
+ prefix={<ActivityLogUserName logItem={logItem} />}
suffix={changeSuffix}
/>
),
@@ -262,8 +261,8 @@ export function dashboardActivityDescriber(logItem: ActivityLogItem, asNotificat
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> shared{' '}
- {asNotification ? 'your' : 'the'} dashboard {nameAndLink(logItem)}
+ <ActivityLogUserName logItem={logItem} /> shared {asNotification ? 'your' : 'the'} dashboard{' '}
+ {nameAndLink(logItem)}
</>
),
}
@@ -273,8 +272,8 @@ export function dashboardActivityDescriber(logItem: ActivityLogItem, asNotificat
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> deleted shared link for{' '}
- {asNotification ? 'your' : 'the'} dashboard {nameAndLink(logItem)}
+ <ActivityLogUserName logItem={logItem} /> deleted shared link for {asNotification ? 'your' : 'the'}{' '}
+ dashboard {nameAndLink(logItem)}
</>
),
}
@@ -284,8 +283,8 @@ export function dashboardActivityDescriber(logItem: ActivityLogItem, asNotificat
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> refreshed the shared link
- for {asNotification ? 'your' : 'the'} dashboard {nameAndLink(logItem)}
+ <ActivityLogUserName logItem={logItem} /> refreshed the shared link for{' '}
+ {asNotification ? 'your' : 'the'} dashboard {nameAndLink(logItem)}
</>
),
}
diff --git a/frontend/src/scenes/data-management/dataManagementDescribers.tsx b/frontend/src/scenes/data-management/dataManagementDescribers.tsx
index 0670d9d743c8..d8588a018668 100644
--- a/frontend/src/scenes/data-management/dataManagementDescribers.tsx
+++ b/frontend/src/scenes/data-management/dataManagementDescribers.tsx
@@ -1,12 +1,12 @@
import {
ActivityChange,
ActivityLogItem,
+ ActivityLogUserName,
ChangeMapping,
Description,
HumanizedChange,
defaultDescriber,
detectBoolean,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
import { SentenceList } from 'lib/components/ActivityLog/SentenceList'
import { ObjectTags } from 'lib/components/ObjectTags/ObjectTags'
@@ -132,7 +132,7 @@ export function dataManagementActivityDescriber(logItem: ActivityLogItem, asNoti
description: (
<SentenceList
listParts={changes}
- prefix={<strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>}
+ prefix={<ActivityLogUserName logItem={logItem} />}
suffix={changeSuffix}
/>
),
@@ -144,8 +144,8 @@ export function dataManagementActivityDescriber(logItem: ActivityLogItem, asNoti
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> deleted{' '}
- <DescribeType logItem={logItem} /> {nameAndLink(logItem)}
+ <ActivityLogUserName logItem={logItem} /> deleted <DescribeType logItem={logItem} />{' '}
+ {nameAndLink(logItem)}
</>
),
}
diff --git a/frontend/src/scenes/data-pipelines/batch-exports/activityDescriptions.tsx b/frontend/src/scenes/data-pipelines/batch-exports/activityDescriptions.tsx
index bb3860f55b37..7f62315bf76b 100644
--- a/frontend/src/scenes/data-pipelines/batch-exports/activityDescriptions.tsx
+++ b/frontend/src/scenes/data-pipelines/batch-exports/activityDescriptions.tsx
@@ -1,9 +1,9 @@
import {
ActivityChange,
ActivityLogItem,
+ ActivityLogUserName,
HumanizedChange,
defaultDescriber,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
import { Link } from 'lib/lemon-ui/Link'
import { urls } from 'scenes/urls'
@@ -240,14 +240,13 @@ function describeFieldChange(label: string, before: string | null, after: string
// ---------------------------------------------------------------------------
export function batchExportActivityDescriber(logItem: ActivityLogItem, asNotification?: boolean): HumanizedChange {
- const name = userNameForLogItem(logItem)
const exportName = nameOrLinkToBatchExport(logItem?.item_id, logItem?.detail.name)
if (logItem.activity == 'created') {
return {
description: (
<>
- <strong className="ph-no-capture">{name}</strong> created batch export {exportName}
+ <ActivityLogUserName logItem={logItem} /> created batch export {exportName}
</>
),
}
@@ -258,8 +257,7 @@ export function batchExportActivityDescriber(logItem: ActivityLogItem, asNotific
return {
description: (
<>
- <strong className="ph-no-capture">{name}</strong> deleted batch export{' '}
- <strong>{displayName}</strong>
+ <ActivityLogUserName logItem={logItem} /> deleted batch export <strong>{displayName}</strong>
</>
),
}
@@ -307,7 +305,7 @@ export function batchExportActivityDescriber(logItem: ActivityLogItem, asNotific
return {
description: (
<>
- <strong className="ph-no-capture">{name}</strong> updated batch export {exportName}
+ <ActivityLogUserName logItem={logItem} /> updated batch export {exportName}
</>
),
}
@@ -317,11 +315,11 @@ export function batchExportActivityDescriber(logItem: ActivityLogItem, asNotific
description:
changes.length === 1 ? (
<>
- <strong className="ph-no-capture">{name}</strong> {changes[0].inline} batch export {exportName}
+ <ActivityLogUserName logItem={logItem} /> {changes[0].inline} batch export {exportName}
</>
) : (
<div>
- <strong className="ph-no-capture">{name}</strong> updated batch export {exportName}
+ <ActivityLogUserName logItem={logItem} /> updated batch export {exportName}
<ul className="ml-5 list-disc">
{changes.map((c, i) => (
<li key={i}>{c.inlist}</li>
diff --git a/frontend/src/scenes/data-pipelines/batch-imports/activityDescriptions.tsx b/frontend/src/scenes/data-pipelines/batch-imports/activityDescriptions.tsx
index 1c9713f7c650..1a61abf30d28 100644
--- a/frontend/src/scenes/data-pipelines/batch-imports/activityDescriptions.tsx
+++ b/frontend/src/scenes/data-pipelines/batch-imports/activityDescriptions.tsx
@@ -1,8 +1,8 @@
import {
ActivityLogItem,
+ ActivityLogUserName,
HumanizedChange,
defaultDescriber,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
const getDisplayName = (logItem: ActivityLogItem): string => {
@@ -30,8 +30,7 @@ export function batchImportActivityDescriber(logItem: ActivityLogItem, asNotific
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> created{' '}
- <strong>{getDisplayName(logItem)}</strong>
+ <ActivityLogUserName logItem={logItem} /> created <strong>{getDisplayName(logItem)}</strong>
</>
),
}
@@ -41,8 +40,7 @@ export function batchImportActivityDescriber(logItem: ActivityLogItem, asNotific
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> deleted{' '}
- <strong>{getDisplayName(logItem)}</strong>
+ <ActivityLogUserName logItem={logItem} /> deleted <strong>{getDisplayName(logItem)}</strong>
</>
),
}
@@ -52,8 +50,7 @@ export function batchImportActivityDescriber(logItem: ActivityLogItem, asNotific
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> updated{' '}
- <strong>{getDisplayName(logItem)}</strong>
+ <ActivityLogUserName logItem={logItem} /> updated <strong>{getDisplayName(logItem)}</strong>
</>
),
}
diff --git a/frontend/src/scenes/data-warehouse/saved_queries/activityDescriptions.tsx b/frontend/src/scenes/data-warehouse/saved_queries/activityDescriptions.tsx
index d1bab359eb6d..2c6b4b534e88 100644
--- a/frontend/src/scenes/data-warehouse/saved_queries/activityDescriptions.tsx
+++ b/frontend/src/scenes/data-warehouse/saved_queries/activityDescriptions.tsx
@@ -1,9 +1,9 @@
import {
ActivityChange,
ActivityLogItem,
+ ActivityLogUserName,
HumanizedChange,
defaultDescriber,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
import { SentenceList } from 'lib/components/ActivityLog/SentenceList'
@@ -59,7 +59,7 @@ export function dataWarehouseSavedQueryActivityDescriber(
return { description: null }
}
- const user = <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>
+ const user = <ActivityLogUserName logItem={logItem} />
const viewName = logItem.detail?.name ? <strong>{logItem.detail.name}</strong> : <i>a view</i>
if (logItem.activity === 'created') {
diff --git a/frontend/src/scenes/experiments/experimentActivityDescriber.tsx b/frontend/src/scenes/experiments/experimentActivityDescriber.tsx
index 2d1e44580f51..17c790e7107b 100644
--- a/frontend/src/scenes/experiments/experimentActivityDescriber.tsx
+++ b/frontend/src/scenes/experiments/experimentActivityDescriber.tsx
@@ -1,6 +1,6 @@
import { match } from 'ts-pattern'
-import { ActivityLogItem, HumanizedChange, userNameForLogItem } from 'lib/components/ActivityLog/humanizeActivity'
+import { ActivityLogItem, ActivityLogUserName, HumanizedChange } from 'lib/components/ActivityLog/humanizeActivity'
import { SentenceList } from 'lib/components/ActivityLog/SentenceList'
import { LemonCard } from 'lib/lemon-ui/LemonCard'
@@ -40,7 +40,7 @@ export const ExperimentDetails = ({
const UnknownAction = ({ logItem }: { logItem: ActivityLogItem }): JSX.Element => {
return (
<SentenceList
- prefix={<strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>}
+ prefix={<ActivityLogUserName logItem={logItem} />}
listParts={['performed an unknown action on']}
suffix={nameOrLinkToExperiment(logItem.detail.name, logItem.item_id)}
/>
@@ -125,7 +125,7 @@ export const experimentActivityDescriber = (logItem: ActivityLogItem): Humanized
return {
description: (
<SentenceList
- prefix={<strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>}
+ prefix={<ActivityLogUserName logItem={logItem} />}
listParts={['added shared metric']}
suffix={
<span>
@@ -141,7 +141,7 @@ export const experimentActivityDescriber = (logItem: ActivityLogItem): Humanized
return {
description: (
<SentenceList
- prefix={<strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>}
+ prefix={<ActivityLogUserName logItem={logItem} />}
listParts={['updated configuration for shared metric']}
suffix={
<span>
@@ -157,7 +157,7 @@ export const experimentActivityDescriber = (logItem: ActivityLogItem): Humanized
return {
description: (
<SentenceList
- prefix={<strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>}
+ prefix={<ActivityLogUserName logItem={logItem} />}
listParts={['created a new experiment holdout:']}
suffix={<strong>{logItem.detail.name}</strong>}
/>
@@ -171,7 +171,7 @@ export const experimentActivityDescriber = (logItem: ActivityLogItem): Humanized
return {
description: (
<SentenceList
- prefix={<strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>}
+ prefix={<ActivityLogUserName logItem={logItem} />}
listParts={[
isSharedMetric ? (
<span>created a new shared metric:</span>
@@ -197,7 +197,7 @@ export const experimentActivityDescriber = (logItem: ActivityLogItem): Humanized
return {
description: (
<SentenceList
- prefix={<strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>}
+ prefix={<ActivityLogUserName logItem={logItem} />}
listParts={['deleted experiment:']}
suffix={logItem.detail.name}
/>
@@ -208,7 +208,7 @@ export const experimentActivityDescriber = (logItem: ActivityLogItem): Humanized
return {
description: (
<SentenceList
- prefix={<strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>}
+ prefix={<ActivityLogUserName logItem={logItem} />}
listParts={['removed shared metric']}
suffix={
<span>
@@ -227,7 +227,7 @@ export const experimentActivityDescriber = (logItem: ActivityLogItem): Humanized
return {
description: (
<SentenceList
- prefix={<strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>}
+ prefix={<ActivityLogUserName logItem={logItem} />}
listParts={['deleted shared metric:']}
suffix={logItem.detail.name}
/>
@@ -241,7 +241,7 @@ export const experimentActivityDescriber = (logItem: ActivityLogItem): Humanized
return {
description: (
<SentenceList
- prefix={<strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>}
+ prefix={<ActivityLogUserName logItem={logItem} />}
listParts={['deleted experiment holdout:']}
suffix={<strong>{logItem.detail.name}</strong>}
/>
@@ -252,7 +252,7 @@ export const experimentActivityDescriber = (logItem: ActivityLogItem): Humanized
return {
description: (
<SentenceList
- prefix={<strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>}
+ prefix={<ActivityLogUserName logItem={logItem} />}
listParts={['deleted experiment:']}
suffix={nameOrLinkToExperiment(detail.name, item_id)}
/>
@@ -263,7 +263,7 @@ export const experimentActivityDescriber = (logItem: ActivityLogItem): Humanized
return {
description: (
<SentenceList
- prefix={<strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>}
+ prefix={<ActivityLogUserName logItem={logItem} />}
listParts={['restored experiment:']}
suffix={nameOrLinkToExperiment(detail.name, item_id)}
/>
@@ -274,7 +274,7 @@ export const experimentActivityDescriber = (logItem: ActivityLogItem): Humanized
return {
description: (
<SentenceList
- prefix={<strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>}
+ prefix={<ActivityLogUserName logItem={logItem} />}
listParts={['paused experiment:']}
suffix={nameOrLinkToExperiment(detail.name, item_id)}
/>
@@ -285,7 +285,7 @@ export const experimentActivityDescriber = (logItem: ActivityLogItem): Humanized
return {
description: (
<SentenceList
- prefix={<strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>}
+ prefix={<ActivityLogUserName logItem={logItem} />}
listParts={['resumed experiment:']}
suffix={nameOrLinkToExperiment(detail.name, item_id)}
/>
@@ -296,7 +296,7 @@ export const experimentActivityDescriber = (logItem: ActivityLogItem): Humanized
return {
description: (
<SentenceList
- prefix={<strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>}
+ prefix={<ActivityLogUserName logItem={logItem} />}
listParts={['froze exposure for']}
suffix={nameOrLinkToExperiment(detail.name, item_id)}
/>
@@ -307,7 +307,7 @@ export const experimentActivityDescriber = (logItem: ActivityLogItem): Humanized
return {
description: (
<SentenceList
- prefix={<strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>}
+ prefix={<ActivityLogUserName logItem={logItem} />}
listParts={['unfroze exposure for']}
suffix={nameOrLinkToExperiment(detail.name, item_id)}
/>
@@ -384,7 +384,7 @@ export const experimentActivityDescriber = (logItem: ActivityLogItem): Humanized
return {
description: (
<SentenceList
- prefix={<strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>}
+ prefix={<ActivityLogUserName logItem={logItem} />}
listParts={listParts}
suffix={suffix}
/>
diff --git a/frontend/src/scenes/exports/activityDescriptions.tsx b/frontend/src/scenes/exports/activityDescriptions.tsx
index ea9609f11909..4bf3c784c6e6 100644
--- a/frontend/src/scenes/exports/activityDescriptions.tsx
+++ b/frontend/src/scenes/exports/activityDescriptions.tsx
@@ -1,8 +1,8 @@
import {
ActivityLogItem,
+ ActivityLogUserName,
HumanizedChange,
defaultDescriber,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
import { Link } from 'lib/lemon-ui/Link'
import { urls } from 'scenes/urls'
@@ -23,8 +23,7 @@ export function exportedAssetActivityDescriber(logItem: ActivityLogItem, asNotif
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> exported{' '}
- {asNotification ? 'your ' : ''}
+ <ActivityLogUserName logItem={logItem} /> exported {asNotification ? 'your ' : ''}
<Link to={urls.exports()}>{logItem.detail.name || 'an export'}</Link> as {formatLabel}
</>
),
diff --git a/frontend/src/scenes/feature-flags/activityDescriptions.tsx b/frontend/src/scenes/feature-flags/activityDescriptions.tsx
index 347c9c302849..3fef5e0f55ac 100644
--- a/frontend/src/scenes/feature-flags/activityDescriptions.tsx
+++ b/frontend/src/scenes/feature-flags/activityDescriptions.tsx
@@ -3,12 +3,12 @@ import { Fragment } from 'react'
import {
ActivityChange,
ActivityLogItem,
+ ActivityLogUserName,
ChangeMapping,
Description,
HumanizedChange,
defaultDescriber,
detectBoolean,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
import { SentenceList } from 'lib/components/ActivityLog/SentenceList'
import { ObjectTags } from 'lib/components/ObjectTags/ObjectTags'
@@ -411,16 +411,14 @@ const EXCLUDED_FLAG_FIELDS = new Set(
)
const getActorName = (logItem: ActivityLogItem): JSX.Element => {
- const userName = userNameForLogItem(logItem)
if (logItem.detail.trigger?.job_type === 'scheduled_change') {
return (
<>
- <strong className="ph-no-capture">{userName}</strong>{' '}
- <span className="text-muted">(via scheduled change)</span>
+ <ActivityLogUserName logItem={logItem} /> <span className="text-muted">(via scheduled change)</span>
</>
)
}
- return <strong className="ph-no-capture">{userName}</strong>
+ return <ActivityLogUserName logItem={logItem} />
}
export function flagActivityDescriber(logItem: ActivityLogItem, asNotification?: boolean): HumanizedChange {
diff --git a/frontend/src/scenes/groups/activityDescriptions.tsx b/frontend/src/scenes/groups/activityDescriptions.tsx
index f43ea073b0d6..60491408514e 100644
--- a/frontend/src/scenes/groups/activityDescriptions.tsx
+++ b/frontend/src/scenes/groups/activityDescriptions.tsx
@@ -1,8 +1,8 @@
import {
ActivityLogItem,
+ ActivityLogUserName,
HumanizedChange,
defaultDescriber,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
export function groupActivityDescriber(logItem: ActivityLogItem, asNotification?: boolean): HumanizedChange {
@@ -15,9 +15,8 @@ export function groupActivityDescriber(logItem: ActivityLogItem, asNotification?
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>{' '}
- {logItem.detail?.changes?.[0]?.action || 'changed'} the <code>{logItem.detail?.name}</code>{' '}
- property.
+ <ActivityLogUserName logItem={logItem} /> {logItem.detail?.changes?.[0]?.action || 'changed'} the{' '}
+ <code>{logItem.detail?.name}</code> property.
</>
),
}
diff --git a/frontend/src/scenes/hog-functions/misc/activityDescriptions.tsx b/frontend/src/scenes/hog-functions/misc/activityDescriptions.tsx
index b373da20260c..8008063f8cbe 100644
--- a/frontend/src/scenes/hog-functions/misc/activityDescriptions.tsx
+++ b/frontend/src/scenes/hog-functions/misc/activityDescriptions.tsx
@@ -2,9 +2,9 @@ import { Suspense } from 'react'
import {
ActivityLogItem,
+ ActivityLogUserName,
HumanizedChange,
defaultDescriber,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
import { LemonDropdown } from 'lib/lemon-ui/LemonDropdown'
import { Link } from 'lib/lemon-ui/Link'
@@ -74,7 +74,7 @@ export function hogFunctionActivityDescriber(logItem: ActivityLogItem, asNotific
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> created the {objectNoun}:{' '}
+ <ActivityLogUserName logItem={logItem} /> created the {objectNoun}:{' '}
{nameOrLinkToHogFunction(logItem?.item_id, logItem?.detail.name)}
</>
),
@@ -85,21 +85,19 @@ export function hogFunctionActivityDescriber(logItem: ActivityLogItem, asNotific
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> deleted the {objectNoun}:{' '}
- {logItem.detail.name}
+ <ActivityLogUserName logItem={logItem} /> deleted the {objectNoun}: {logItem.detail.name}
</>
),
}
}
if (logItem.activity == 'restored') {
- const name = userNameForLogItem(logItem)
const functionName = nameOrLinkToHogFunction(logItem?.item_id, logItem?.detail.name)
return {
description: (
<>
- <strong className="ph-no-capture">{name}</strong> restored the {objectNoun}: {functionName}
+ <ActivityLogUserName logItem={logItem} /> restored the {objectNoun}: {functionName}
</>
),
}
@@ -115,8 +113,7 @@ export function hogFunctionActivityDescriber(logItem: ActivityLogItem, asNotific
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>{' '}
- {draftActivities[logItem.activity]} the {objectNoun}:{' '}
+ <ActivityLogUserName logItem={logItem} /> {draftActivities[logItem.activity]} the {objectNoun}:{' '}
{nameOrLinkToHogFunction(logItem?.item_id, logItem?.detail.name)}
</>
),
@@ -259,19 +256,17 @@ export function hogFunctionActivityDescriber(logItem: ActivityLogItem, asNotific
})
}
}
- const name = userNameForLogItem(logItem)
const functionName = nameOrLinkToHogFunction(logItem?.item_id, logItem?.detail.name)
return {
description:
changes.length == 1 ? (
<>
- <strong className="ph-no-capture">{name}</strong> {changes[0].inline} the {objectNoun}:{' '}
- {functionName}
+ <ActivityLogUserName logItem={logItem} /> {changes[0].inline} the {objectNoun}: {functionName}
</>
) : (
<div>
- <strong className="ph-no-capture">{name}</strong> updated the {objectNoun}: {functionName}
+ <ActivityLogUserName logItem={logItem} /> updated the {objectNoun}: {functionName}
<ul className="ml-5 list-disc">
{changes.map((c, i) => (
<li key={i}>{c.inlist}</li>
diff --git a/frontend/src/scenes/notebooks/Notebook/NotebookHistory.tsx b/frontend/src/scenes/notebooks/Notebook/NotebookHistory.tsx
index f36728cd58bf..9611f5955a51 100644
--- a/frontend/src/scenes/notebooks/Notebook/NotebookHistory.tsx
+++ b/frontend/src/scenes/notebooks/Notebook/NotebookHistory.tsx
@@ -14,7 +14,12 @@ import {
} from '@posthog/lemon-ui'
import { activityLogLogic } from 'lib/components/ActivityLog/activityLogLogic'
-import { ActivityLogItem, userNameForLogItem } from 'lib/components/ActivityLog/humanizeActivity'
+import {
+ ActivityLogItem,
+ ActivityLogUserName,
+ actorEmailForLogItem,
+ userNameForLogItem,
+} from 'lib/components/ActivityLog/humanizeActivity'
import { TZLabel } from 'lib/components/TZLabel'
import { ActivityScope } from '~/types'
@@ -71,13 +76,13 @@ function NotebookHistoryList({ onItemClick }: { onItemClick: (logItem: ActivityL
<ProfilePicture
user={{
first_name: name,
- email: logItem.user?.email ?? undefined,
+ email: actorEmailForLogItem(logItem) ?? undefined,
}}
type={logItem.is_system ? 'system' : 'person'}
size="md"
/>
<span className="flex-1">
- <b className="ph-no-capture">{name}</b> {actionLabel}
+ <ActivityLogUserName logItem={logItem} /> {actionLabel}
</span>
<span className="text-secondary">
<TZLabel time={logItem.created_at} />
diff --git a/frontend/src/scenes/notebooks/Notebook/notebookActivityDescriber.tsx b/frontend/src/scenes/notebooks/Notebook/notebookActivityDescriber.tsx
index 4676227ee8eb..40d044721604 100644
--- a/frontend/src/scenes/notebooks/Notebook/notebookActivityDescriber.tsx
+++ b/frontend/src/scenes/notebooks/Notebook/notebookActivityDescriber.tsx
@@ -1,11 +1,11 @@
import {
ActivityChange,
ActivityLogItem,
+ ActivityLogUserName,
ChangeMapping,
Description,
HumanizedChange,
defaultDescriber,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
import { SentenceList } from 'lib/components/ActivityLog/SentenceList'
import { Link } from 'lib/lemon-ui/Link'
@@ -71,7 +71,7 @@ export function notebookActivityDescriber(logItem: ActivityLogItem, asNotificati
description: (
<SentenceList
listParts={changes}
- prefix={<strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>}
+ prefix={<ActivityLogUserName logItem={logItem} />}
suffix={changeSuffix}
/>
),
diff --git a/frontend/src/scenes/persons/activityDescriptions.tsx b/frontend/src/scenes/persons/activityDescriptions.tsx
index 209b8c957371..b32019df556d 100644
--- a/frontend/src/scenes/persons/activityDescriptions.tsx
+++ b/frontend/src/scenes/persons/activityDescriptions.tsx
@@ -1,8 +1,8 @@
import {
ActivityLogItem,
+ ActivityLogUserName,
HumanizedChange,
defaultDescriber,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
import { SentenceList } from 'lib/components/ActivityLog/SentenceList'
import { Link } from 'lib/lemon-ui/Link'
@@ -20,8 +20,7 @@ export function personActivityDescriber(logItem: ActivityLogItem, asNotification
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> deleted the person:{' '}
- {logItem.detail.name}
+ <ActivityLogUserName logItem={logItem} /> deleted the person: {logItem.detail.name}
</>
),
}
@@ -35,8 +34,7 @@ export function personActivityDescriber(logItem: ActivityLogItem, asNotification
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> edited this person's
- properties
+ <ActivityLogUserName logItem={logItem} /> edited this person's properties
</>
),
}
@@ -48,7 +46,7 @@ export function personActivityDescriber(logItem: ActivityLogItem, asNotification
<SentenceList
prefix={
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> merged
+ <ActivityLogUserName logItem={logItem} /> merged
</>
}
listParts={logItem.detail.merge.source.flatMap((di, idx) => (
@@ -74,8 +72,7 @@ export function personActivityDescriber(logItem: ActivityLogItem, asNotification
<SentenceList
prefix={
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> split this
- person into
+ <ActivityLogUserName logItem={logItem} /> split this person into
</>
}
listParts={normalizedDistinctIds.map((di) => (
diff --git a/frontend/src/scenes/product-tours/activityDescriptions.tsx b/frontend/src/scenes/product-tours/activityDescriptions.tsx
index ae5a3e8a98f8..f87043344134 100644
--- a/frontend/src/scenes/product-tours/activityDescriptions.tsx
+++ b/frontend/src/scenes/product-tours/activityDescriptions.tsx
@@ -1,8 +1,8 @@
import {
ActivityLogItem,
+ ActivityLogUserName,
HumanizedChange,
defaultDescriber,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
import { Link } from 'lib/lemon-ui/Link'
import { urls } from 'scenes/urls'
@@ -22,7 +22,7 @@ export function productTourActivityDescriber(logItem: ActivityLogItem, asNotific
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> created the product tour:{' '}
+ <ActivityLogUserName logItem={logItem} /> created the product tour:{' '}
{nameOrLinkToTour(logItem?.item_id, logItem?.detail.name)}
</>
),
@@ -33,7 +33,7 @@ export function productTourActivityDescriber(logItem: ActivityLogItem, asNotific
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> updated the product tour:{' '}
+ <ActivityLogUserName logItem={logItem} /> updated the product tour:{' '}
{nameOrLinkToTour(logItem?.item_id, logItem?.detail.name)}
</>
),
@@ -44,7 +44,7 @@ export function productTourActivityDescriber(logItem: ActivityLogItem, asNotific
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> deleted the product tour:{' '}
+ <ActivityLogUserName logItem={logItem} /> deleted the product tour:{' '}
{nameOrLinkToTour(logItem?.item_id, logItem?.detail.name)}
</>
),
diff --git a/frontend/src/scenes/saved-insights/activityDescriptions.tsx b/frontend/src/scenes/saved-insights/activityDescriptions.tsx
index 9d0fe481dd4c..f269d7402114 100644
--- a/frontend/src/scenes/saved-insights/activityDescriptions.tsx
+++ b/frontend/src/scenes/saved-insights/activityDescriptions.tsx
@@ -4,12 +4,12 @@ import { Fragment } from 'react'
import {
ActivityChange,
ActivityLogItem,
+ ActivityLogUserName,
ChangeMapping,
Description,
HumanizedChange,
defaultDescriber,
detectBoolean,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
import { SentenceList } from 'lib/components/ActivityLog/SentenceList'
import {
@@ -285,7 +285,7 @@ export function insightActivityDescriber(logItem: ActivityLogItem, asNotificatio
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> created the insight:{' '}
+ <ActivityLogUserName logItem={logItem} /> created the insight:{' '}
{nameOrLinkToInsight(logItem?.detail.short_id, logItem?.detail.name)}
</>
),
@@ -296,8 +296,8 @@ export function insightActivityDescriber(logItem: ActivityLogItem, asNotificatio
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> deleted{' '}
- {asNotification ? 'your' : 'the'} insight: {logItem.detail.name}
+ <ActivityLogUserName logItem={logItem} /> deleted {asNotification ? 'your' : 'the'} insight:{' '}
+ {logItem.detail.name}
</>
),
}
@@ -318,8 +318,8 @@ export function insightActivityDescriber(logItem: ActivityLogItem, asNotificatio
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> shared{' '}
- {asNotification ? 'your' : 'the'} insight: {logItem.detail.name}.
+ <ActivityLogUserName logItem={logItem} /> shared {asNotification ? 'your' : 'the'} insight:{' '}
+ {logItem.detail.name}.
</>
),
}
@@ -329,8 +329,8 @@ export function insightActivityDescriber(logItem: ActivityLogItem, asNotificatio
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> deleted shared link for{' '}
- {asNotification ? 'your' : 'the'} insight: {logItem.detail.name}.
+ <ActivityLogUserName logItem={logItem} /> deleted shared link for {asNotification ? 'your' : 'the'}{' '}
+ insight: {logItem.detail.name}.
</>
),
}
@@ -380,7 +380,7 @@ export function insightActivityDescriber(logItem: ActivityLogItem, asNotificatio
description: (
<SentenceList
listParts={changes}
- prefix={<strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>}
+ prefix={<ActivityLogUserName logItem={logItem} />}
suffix={changeSuffix}
/>
),
@@ -398,7 +398,7 @@ export function insightActivityDescriber(logItem: ActivityLogItem, asNotificatio
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> exported{' '}
+ <ActivityLogUserName logItem={logItem} /> exported{' '}
{nameOrLinkToInsight(logItem?.detail.short_id, logItem?.detail.name)} as a {exportType}
</>
),
diff --git a/frontend/src/scenes/session-recordings/activityDescription.tsx b/frontend/src/scenes/session-recordings/activityDescription.tsx
index c4659bfe1dd6..30fc944a9db2 100644
--- a/frontend/src/scenes/session-recordings/activityDescription.tsx
+++ b/frontend/src/scenes/session-recordings/activityDescription.tsx
@@ -1,8 +1,8 @@
import {
ActivityLogItem,
+ ActivityLogUserName,
HumanizedChange,
defaultDescriber,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
import { ActivityScope } from '~/types'
@@ -17,7 +17,7 @@ export function replayActivityDescriber(logItem: ActivityLogItem, asNotification
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> bulk deleted{' '}
+ <ActivityLogUserName logItem={logItem} /> bulk deleted{' '}
<b>{logItem.detail?.name || 'session recordings'}</b>
</>
),
diff --git a/frontend/src/scenes/settings/organization/activityDescriptions.test.tsx b/frontend/src/scenes/settings/organization/activityDescriptions.test.tsx
new file mode 100644
index 000000000000..14836ee5dd17
--- /dev/null
+++ b/frontend/src/scenes/settings/organization/activityDescriptions.test.tsx
@@ -0,0 +1,58 @@
+import { render, within } from '@testing-library/react'
+
+import { ActivityLogItem } from 'lib/components/ActivityLog/humanizeActivity'
+
+import { ActivityScope } from '~/types'
+
+import { organizationActivityDescriber } from './activityDescriptions'
+
+describe('organizationActivityDescriber', () => {
+ const makeInviteLogItem = (
+ context: Record<string, any>,
+ overrides: Partial<ActivityLogItem> = {}
+ ): ActivityLogItem => ({
+ user: { first_name: 'Grace', last_name: 'Hopper', email: '[email protected]' },
+ activity: 'created',
+ created_at: '2026-06-04T00:00:00Z',
+ scope: ActivityScope.ORGANIZATION_INVITE,
+ detail: {
+ merge: null,
+ trigger: null,
+ changes: null,
+ name: null,
+ context: {
+ organization_name: 'Analytics Inc',
+ target_email: '[email protected]',
+ level: 'member',
+ inviter_user_name: 'Ada Lovelace',
+ inviter_user_email: '[email protected]',
+ ...context,
+ },
+ },
+ ...overrides,
+ })
+
+ // Base UI marks the element it merges the tooltip trigger onto. Opening the popup is not
+ // reliable in jsdom because of the hover delay, so assert on the trigger instead.
+ const renderInviterName = (context: Record<string, any>, overrides?: Partial<ActivityLogItem>): HTMLElement => {
+ const { description } = organizationActivityDescriber(makeInviteLogItem(context, overrides))
+ const { container } = render(description as JSX.Element)
+ return within(container).getByText('Ada Lovelace')
+ }
+
+ it.each([
+ ['offers the inviter email on an ordinary invite row', {}, undefined, true],
+ ['stays plain when the context carries no inviter email', { inviter_user_email: null }, undefined, false],
+ [
+ 'stays plain when a staff member was impersonating the actor',
+ {},
+ { was_impersonated: true } as Partial<ActivityLogItem>,
+ false,
+ ],
+ ['stays plain when the actor is the system', {}, { is_system: true } as Partial<ActivityLogItem>, false],
+ ])('%s', (_name, context, overrides, expectTooltip) => {
+ const element = renderInviterName(context, overrides)
+ expect(element.hasAttribute('data-base-ui-tooltip-trigger')).toBe(expectTooltip)
+ expect(element.classList.contains('ph-no-capture')).toBe(true)
+ })
+})
diff --git a/frontend/src/scenes/settings/organization/activityDescriptions.tsx b/frontend/src/scenes/settings/organization/activityDescriptions.tsx
index 8dee27d9d062..c21453fb5b20 100644
--- a/frontend/src/scenes/settings/organization/activityDescriptions.tsx
+++ b/frontend/src/scenes/settings/organization/activityDescriptions.tsx
@@ -1,9 +1,10 @@
import {
ActivityLogItem,
+ ActivityLogUserName,
HumanizedChange,
defaultDescriber,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
+import { UserNameWithEmail } from 'lib/components/ActivityLog/UserNameWithEmail'
import { OrganizationMembershipLevel } from 'lib/constants'
import { Link } from 'lib/lemon-ui/Link'
import { membershipLevelToName } from 'lib/utils/permissioning'
@@ -30,7 +31,7 @@ export function organizationActivityDescriber(logItem: ActivityLogItem, asNotifi
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> created the organization{' '}
+ <ActivityLogUserName logItem={logItem} /> created the organization{' '}
<strong>{nameOrLinkToOrganization(logItem?.detail.name)}</strong>
</>
),
@@ -41,7 +42,7 @@ export function organizationActivityDescriber(logItem: ActivityLogItem, asNotifi
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> deleted the organization{' '}
+ <ActivityLogUserName logItem={logItem} /> deleted the organization{' '}
<strong>{logItem.detail.name || 'Organization'}</strong>
</>
),
@@ -62,8 +63,8 @@ export function organizationActivityDescriber(logItem: ActivityLogItem, asNotifi
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> {changeDescription} for
- organization {nameOrLinkToOrganization(logItem?.detail.name)}
+ <ActivityLogUserName logItem={logItem} /> {changeDescription} for organization{' '}
+ {nameOrLinkToOrganization(logItem?.detail.name)}
</>
),
}
@@ -71,9 +72,8 @@ export function organizationActivityDescriber(logItem: ActivityLogItem, asNotifi
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> updated{' '}
- <strong>{changes.length} settings</strong> for organization{' '}
- {nameOrLinkToOrganization(logItem?.detail.name)}
+ <ActivityLogUserName logItem={logItem} /> updated <strong>{changes.length} settings</strong> for
+ organization {nameOrLinkToOrganization(logItem?.detail.name)}
</>
),
}
@@ -93,7 +93,7 @@ function organizationMembershipActivityDescriber(logItem: ActivityLogItem, asNot
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> added user{' '}
+ <ActivityLogUserName logItem={logItem} /> added user{' '}
<strong>
{userName} ({userEmail})
</strong>{' '}
@@ -107,7 +107,7 @@ function organizationMembershipActivityDescriber(logItem: ActivityLogItem, asNot
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> removed user{' '}
+ <ActivityLogUserName logItem={logItem} /> removed user{' '}
<strong>
{userName} ({userEmail})
</strong>{' '}
@@ -130,7 +130,7 @@ function organizationMembershipActivityDescriber(logItem: ActivityLogItem, asNot
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> changed{' '}
+ <ActivityLogUserName logItem={logItem} /> changed{' '}
<strong>
{userName} ({userEmail})
</strong>
@@ -144,7 +144,7 @@ function organizationMembershipActivityDescriber(logItem: ActivityLogItem, asNot
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> updated{' '}
+ <ActivityLogUserName logItem={logItem} /> updated{' '}
<strong>
{userName} ({userEmail})
</strong>
@@ -162,15 +162,22 @@ function organizationInviteActivityDescriber(logItem: ActivityLogItem, asNotific
const targetEmail = context?.target_email || ''
const organizationName = context?.organization_name || 'the organization'
const level = context?.level || 'member'
- const inviterName = context?.inviter_user_name || userNameForLogItem(logItem) || 'System'
+ // The context names whoever created the invite, who is not always the person who acted on this
+ // row, so the email must come from the same context as the name. A system or impersonated row
+ // hides it, as the actor's name and avatar do.
+ const inviterEmail = logItem.is_system || logItem.was_impersonated ? undefined : context?.inviter_user_email
+ const inviter = context?.inviter_user_name ? (
+ <UserNameWithEmail name={context.inviter_user_name} email={inviterEmail} />
+ ) : (
+ <ActivityLogUserName logItem={logItem} />
+ )
if (logItem.activity == 'created') {
return {
description: (
<>
- <strong className="ph-no-capture">{inviterName}</strong> sent an invitation to{' '}
- <strong>{targetEmail}</strong> to join organization {nameOrLinkToOrganization(organizationName)} as{' '}
- <strong>{level}</strong>
+ {inviter} sent an invitation to <strong>{targetEmail}</strong> to join organization{' '}
+ {nameOrLinkToOrganization(organizationName)} as <strong>{level}</strong>
</>
),
}
@@ -180,8 +187,8 @@ function organizationInviteActivityDescriber(logItem: ActivityLogItem, asNotific
return {
description: (
<>
- <strong className="ph-no-capture">{inviterName}</strong> revoked the invitation for{' '}
- <strong>{targetEmail}</strong> to join organization {nameOrLinkToOrganization(organizationName)}
+ {inviter} revoked the invitation for <strong>{targetEmail}</strong> to join organization{' '}
+ {nameOrLinkToOrganization(organizationName)}
</>
),
}
@@ -201,9 +208,8 @@ function organizationInviteActivityDescriber(logItem: ActivityLogItem, asNotific
return {
description: (
<>
- <strong className="ph-no-capture">{inviterName}</strong> {changeDescription} for the invitation
- sent to <strong>{targetEmail}</strong> to join organization{' '}
- {nameOrLinkToOrganization(organizationName)}
+ {inviter} {changeDescription} for the invitation sent to <strong>{targetEmail}</strong> to join
+ organization {nameOrLinkToOrganization(organizationName)}
</>
),
}
@@ -211,8 +217,7 @@ function organizationInviteActivityDescriber(logItem: ActivityLogItem, asNotific
return {
description: (
<>
- <strong className="ph-no-capture">{inviterName}</strong> updated{' '}
- <strong>{changes.length} settings</strong> for the invitation sent to{' '}
+ {inviter} updated <strong>{changes.length} settings</strong> for the invitation sent to{' '}
<strong>{targetEmail}</strong> to join organization {nameOrLinkToOrganization(organizationName)}
</>
),
@@ -264,7 +269,7 @@ export function organizationDomainActivityDescriber(
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>{' '}
+ <ActivityLogUserName logItem={logItem} />{' '}
{descriptions.length === 1 ? (
descriptions[0]
) : (
@@ -284,8 +289,7 @@ export function organizationDomainActivityDescriber(
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> deleted domain{' '}
- <strong>{domainName}</strong>
+ <ActivityLogUserName logItem={logItem} /> deleted domain <strong>{domainName}</strong>
</>
),
}
@@ -295,8 +299,7 @@ export function organizationDomainActivityDescriber(
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> added domain{' '}
- <strong>{domainName}</strong>
+ <ActivityLogUserName logItem={logItem} /> added domain <strong>{domainName}</strong>
</>
),
}
@@ -318,8 +321,8 @@ export function legalDocumentActivityDescriber(logItem: ActivityLogItem, asNotif
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> generated {article}{' '}
- <strong>{documentType}</strong> for <strong>{companyName}</strong>
+ <ActivityLogUserName logItem={logItem} /> generated {article} <strong>{documentType}</strong> for{' '}
+ <strong>{companyName}</strong>
</>
),
}
@@ -329,8 +332,8 @@ export function legalDocumentActivityDescriber(logItem: ActivityLogItem, asNotif
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> deleted {article}{' '}
- <strong>{documentType}</strong> for <strong>{companyName}</strong>
+ <ActivityLogUserName logItem={logItem} /> deleted {article} <strong>{documentType}</strong> for{' '}
+ <strong>{companyName}</strong>
</>
),
}
diff --git a/frontend/src/scenes/settings/project/activityDescriptions.tsx b/frontend/src/scenes/settings/project/activityDescriptions.tsx
index 9e85e9a2971a..1c870a417005 100644
--- a/frontend/src/scenes/settings/project/activityDescriptions.tsx
+++ b/frontend/src/scenes/settings/project/activityDescriptions.tsx
@@ -1,9 +1,9 @@
import {
ActivityLogItem,
+ ActivityLogUserName,
Describer,
HumanizedChange,
defaultDescriber,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
const projectNameForLog = (logItem: ActivityLogItem): string => {
@@ -21,7 +21,7 @@ export const projectSecretAPIKeyActivityDescriber: Describer = (logItem: Activit
return { description: null }
}
- const actor = <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>
+ const actor = <ActivityLogUserName logItem={logItem} />
const keyName = <strong>{keyLabel(logItem)}</strong>
const scopeName = <strong>{projectNameForLog(logItem)}</strong>
diff --git a/frontend/src/scenes/settings/user/activityDescriptions.tsx b/frontend/src/scenes/settings/user/activityDescriptions.tsx
index 365adba75252..71c7b6dd36a1 100644
--- a/frontend/src/scenes/settings/user/activityDescriptions.tsx
+++ b/frontend/src/scenes/settings/user/activityDescriptions.tsx
@@ -1,9 +1,9 @@
import {
ActivityLogItem,
+ ActivityLogUserName,
Describer,
HumanizedChange,
defaultDescriber,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
export const personalAPIKeyActivityDescriber: Describer = (logItem: ActivityLogItem): HumanizedChange => {
@@ -31,8 +31,8 @@ export const personalAPIKeyActivityDescriber: Describer = (logItem: ActivityLogI
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> created personal API key{' '}
- <strong>{getKeyTitle()}</strong> for <strong>{getScopeDescription()}</strong>
+ <ActivityLogUserName logItem={logItem} /> created personal API key <strong>{getKeyTitle()}</strong>{' '}
+ for <strong>{getScopeDescription()}</strong>
</>
),
}
@@ -42,8 +42,8 @@ export const personalAPIKeyActivityDescriber: Describer = (logItem: ActivityLogI
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> revoked access for personal
- API key <strong>{getKeyTitle()}</strong> to <strong>{getScopeDescription()}</strong>
+ <ActivityLogUserName logItem={logItem} /> revoked access for personal API key{' '}
+ <strong>{getKeyTitle()}</strong> to <strong>{getScopeDescription()}</strong>
</>
),
}
@@ -56,7 +56,7 @@ export const personalAPIKeyActivityDescriber: Describer = (logItem: ActivityLogI
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> rolled personal API key{' '}
+ <ActivityLogUserName logItem={logItem} /> rolled personal API key{' '}
<strong>{getKeyTitle()}</strong> for <strong>{getScopeDescription()}</strong>
</>
),
@@ -66,8 +66,8 @@ export const personalAPIKeyActivityDescriber: Describer = (logItem: ActivityLogI
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> updated personal API key{' '}
- <strong>{getKeyTitle()}</strong> for <strong>{getScopeDescription()}</strong>
+ <ActivityLogUserName logItem={logItem} /> updated personal API key <strong>{getKeyTitle()}</strong>{' '}
+ for <strong>{getScopeDescription()}</strong>
</>
),
}
@@ -77,8 +77,8 @@ export const personalAPIKeyActivityDescriber: Describer = (logItem: ActivityLogI
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> deleted personal API key{' '}
- <strong>{getKeyTitle()}</strong> for access to <strong>{getScopeDescription()}</strong>
+ <ActivityLogUserName logItem={logItem} /> deleted personal API key <strong>{getKeyTitle()}</strong>{' '}
+ for access to <strong>{getScopeDescription()}</strong>
</>
),
}
@@ -116,7 +116,7 @@ export const oauthApplicationActivityDescriber: Describer = (logItem: ActivityLo
return defaultDescriber(logItem)
}
- const actor = <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>
+ const actor = <ActivityLogUserName logItem={logItem} />
const before = asScopeList(scopesChange.before)
const after = asScopeList(scopesChange.after)
diff --git a/frontend/src/scenes/surveys/surveyActivityDescriber.tsx b/frontend/src/scenes/surveys/surveyActivityDescriber.tsx
index 2a59f392f328..c4e30ffd13eb 100644
--- a/frontend/src/scenes/surveys/surveyActivityDescriber.tsx
+++ b/frontend/src/scenes/surveys/surveyActivityDescriber.tsx
@@ -3,12 +3,12 @@ import { P, match } from 'ts-pattern'
import {
ActivityChange,
ActivityLogItem,
+ ActivityLogUserName,
ChangeMapping,
Description,
HumanizedChange,
defaultDescriber,
detectBoolean,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
import { Link } from 'lib/lemon-ui/Link'
import { truncate } from 'lib/utils/strings'
@@ -336,7 +336,7 @@ export function surveyActivityDescriber(logItem: ActivityLogItem, asNotification
return { description: null }
}
- const user = <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>
+ const user = <ActivityLogUserName logItem={logItem} />
const surveyLink = nameOrLinkToSurvey(logItem?.item_id, logItem?.detail.name, logItem.activity)
if (logItem.activity === 'created') {
diff --git a/frontend/src/scenes/team-activity/teamActivityDescriber.tsx b/frontend/src/scenes/team-activity/teamActivityDescriber.tsx
index f8195c9d93d5..22183ab33caf 100644
--- a/frontend/src/scenes/team-activity/teamActivityDescriber.tsx
+++ b/frontend/src/scenes/team-activity/teamActivityDescriber.tsx
@@ -1,11 +1,11 @@
import {
ActivityChange,
ActivityLogItem,
+ ActivityLogUserName,
ChangeMapping,
Description,
HumanizedChange,
defaultDescriber,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
import { SentenceList } from 'lib/components/ActivityLog/SentenceList'
import { PathCleanFilterItem } from 'lib/components/PathCleanFilters/PathCleanFilterItem'
@@ -781,8 +781,8 @@ export function teamActivityDescriber(logItem: ActivityLogItem, asNotification?:
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>{' '}
- {wasSuspended ? 'suspended' : 're-enabled'} workflow email sending on {nameAndLink(logItem)}
+ <ActivityLogUserName logItem={logItem} /> {wasSuspended ? 'suspended' : 're-enabled'} workflow email
+ sending on {nameAndLink(logItem)}
{wasSuspended && reason ? <> (reason: {reason})</> : null}
</>
),
@@ -819,7 +819,7 @@ export function teamActivityDescriber(logItem: ActivityLogItem, asNotification?:
description: (
<SentenceList
listParts={changes}
- prefix={<strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>}
+ prefix={<ActivityLogUserName logItem={logItem} />}
suffix={changeSuffix}
/>
),
diff --git a/products/ai_observability/frontend/prompts/promptActivityDescriber.tsx b/products/ai_observability/frontend/prompts/promptActivityDescriber.tsx
index be090505ae45..f13bb92e3608 100644
--- a/products/ai_observability/frontend/prompts/promptActivityDescriber.tsx
+++ b/products/ai_observability/frontend/prompts/promptActivityDescriber.tsx
@@ -1,8 +1,8 @@
import {
ActivityLogItem,
+ ActivityLogUserName,
HumanizedChange,
defaultDescriber,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
function changeAfter(logItem: ActivityLogItem, field: string): string | null {
@@ -18,7 +18,6 @@ function changeBefore(logItem: ActivityLogItem, field: string): string | null {
// Lifecycle events (create/publish/archive/duplicate) for scope LLMPrompt, written by
// log_llm_prompt_activity in backend activity_logging.py. detail.name is the prompt name.
export function promptActivityDescriber(logItem: ActivityLogItem, asNotification?: boolean): HumanizedChange {
- const user = userNameForLogItem(logItem)
const promptName = logItem?.detail?.name ?? ''
if (logItem.activity === 'created') {
@@ -26,12 +25,12 @@ export function promptActivityDescriber(logItem: ActivityLogItem, asNotification
return {
description: duplicatedFrom ? (
<>
- <strong className="ph-no-capture">{user}</strong> created prompt <b>{promptName}</b> as a copy of{' '}
+ <ActivityLogUserName logItem={logItem} /> created prompt <b>{promptName}</b> as a copy of{' '}
<b>{duplicatedFrom}</b>
</>
) : (
<>
- <strong className="ph-no-capture">{user}</strong> created prompt <b>{promptName}</b>
+ <ActivityLogUserName logItem={logItem} /> created prompt <b>{promptName}</b>
</>
),
}
@@ -45,7 +44,7 @@ export function promptActivityDescriber(logItem: ActivityLogItem, asNotification
return {
description: (
<>
- <strong className="ph-no-capture">{user}</strong> published <b>v{version ?? '?'}</b> of prompt{' '}
+ <ActivityLogUserName logItem={logItem} /> published <b>v{version ?? '?'}</b> of prompt{' '}
<b>{promptName}</b>
{configChanged ? <> (configuration changed)</> : null}
{versionDescription ? <>: "{versionDescription}"</> : null}
@@ -59,7 +58,7 @@ export function promptActivityDescriber(logItem: ActivityLogItem, asNotification
return {
description: (
<>
- <strong className="ph-no-capture">{user}</strong> archived prompt <b>{promptName}</b>
+ <ActivityLogUserName logItem={logItem} /> archived prompt <b>{promptName}</b>
{versionCount ? <> ({versionCount} versions)</> : null}
</>
),
@@ -71,7 +70,7 @@ export function promptActivityDescriber(logItem: ActivityLogItem, asNotification
return {
description: (
<>
- <strong className="ph-no-capture">{user}</strong> duplicated prompt <b>{promptName}</b>
+ <ActivityLogUserName logItem={logItem} /> duplicated prompt <b>{promptName}</b>
{duplicatedTo ? (
<>
{' '}
diff --git a/products/ai_observability/frontend/prompts/promptLabelActivityDescriber.tsx b/products/ai_observability/frontend/prompts/promptLabelActivityDescriber.tsx
index ef0f8f98a85b..4180949d3385 100644
--- a/products/ai_observability/frontend/prompts/promptLabelActivityDescriber.tsx
+++ b/products/ai_observability/frontend/prompts/promptLabelActivityDescriber.tsx
@@ -1,8 +1,8 @@
import {
ActivityLogItem,
+ ActivityLogUserName,
HumanizedChange,
defaultDescriber,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
// detail.name is "{prompt name}: {label name}" (set in backend activity_logging.py).
@@ -19,7 +19,6 @@ function parseDetailName(logItem: ActivityLogItem): { promptName: string; labelN
}
export function promptLabelActivityDescriber(logItem: ActivityLogItem, asNotification?: boolean): HumanizedChange {
- const user = userNameForLogItem(logItem)
const { promptName, labelName } = parseDetailName(logItem)
const change = logItem.detail?.changes?.[0]
const onPrompt = promptName ? (
@@ -33,7 +32,7 @@ export function promptLabelActivityDescriber(logItem: ActivityLogItem, asNotific
return {
description: (
<>
- <strong className="ph-no-capture">{user}</strong> created label <b>{labelName}</b> pointing at{' '}
+ <ActivityLogUserName logItem={logItem} /> created label <b>{labelName}</b> pointing at{' '}
<b>v{String(change?.after ?? '?')}</b>
{onPrompt}
</>
@@ -45,7 +44,7 @@ export function promptLabelActivityDescriber(logItem: ActivityLogItem, asNotific
return {
description: (
<>
- <strong className="ph-no-capture">{user}</strong> moved label <b>{labelName}</b> from{' '}
+ <ActivityLogUserName logItem={logItem} /> moved label <b>{labelName}</b> from{' '}
<b>v{String(change?.before ?? '?')}</b> to <b>v{String(change?.after ?? '?')}</b>
{onPrompt}
</>
@@ -57,7 +56,7 @@ export function promptLabelActivityDescriber(logItem: ActivityLogItem, asNotific
return {
description: (
<>
- <strong className="ph-no-capture">{user}</strong> removed label <b>{labelName}</b> (was pointing at{' '}
+ <ActivityLogUserName logItem={logItem} /> removed label <b>{labelName}</b> (was pointing at{' '}
<b>v{String(change?.before ?? '?')}</b>){onPrompt}
</>
),
diff --git a/products/alerts/frontend/components/activityDescriptions.tsx b/products/alerts/frontend/components/activityDescriptions.tsx
index c981273db298..62458a81a838 100644
--- a/products/alerts/frontend/components/activityDescriptions.tsx
+++ b/products/alerts/frontend/components/activityDescriptions.tsx
@@ -1,8 +1,8 @@
import {
ActivityLogItem,
+ ActivityLogUserName,
HumanizedChange,
defaultDescriber,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
import { Link } from 'lib/lemon-ui/Link'
import { urls } from 'scenes/urls'
@@ -49,7 +49,7 @@ export function alertConfigurationActivityDescriber(
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> added{' '}
+ <ActivityLogUserName logItem={logItem} /> added{' '}
<strong>
{logItem?.detail?.context?.subscriber_name} ({logItem?.detail?.context?.subscriber_email})
</strong>{' '}
@@ -63,8 +63,7 @@ export function alertConfigurationActivityDescriber(
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> created the alert{' '}
- {formattedName(logItem?.detail.name)}
+ <ActivityLogUserName logItem={logItem} /> created the alert {formattedName(logItem?.detail.name)}
{contextDesc}
</>
),
@@ -78,7 +77,7 @@ export function alertConfigurationActivityDescriber(
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> removed{' '}
+ <ActivityLogUserName logItem={logItem} /> removed{' '}
<strong>
{logItem?.detail?.context?.subscriber_name} ({logItem?.detail?.context?.subscriber_email})
</strong>{' '}
@@ -93,8 +92,7 @@ export function alertConfigurationActivityDescriber(
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> deleted the alert:{' '}
- {displayName}
+ <ActivityLogUserName logItem={logItem} /> deleted the alert: {displayName}
{contextDesc}
</>
),
@@ -108,8 +106,8 @@ export function alertConfigurationActivityDescriber(
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> updated the{' '}
- <strong>threshold</strong> for alert {formattedName(logItem?.detail?.context?.alert_name)}
+ <ActivityLogUserName logItem={logItem} /> updated the <strong>threshold</strong> for alert{' '}
+ {formattedName(logItem?.detail?.context?.alert_name)}
{contextDesc}
</>
),
@@ -119,8 +117,7 @@ export function alertConfigurationActivityDescriber(
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> updated the alert{' '}
- {formattedName(logItem?.detail.name)}
+ <ActivityLogUserName logItem={logItem} /> updated the alert {formattedName(logItem?.detail.name)}
{contextDesc}
</>
),
diff --git a/products/canvas/frontend/activityDescriber.tsx b/products/canvas/frontend/activityDescriber.tsx
index 565b5fc12fd6..c41b1adca955 100644
--- a/products/canvas/frontend/activityDescriber.tsx
+++ b/products/canvas/frontend/activityDescriber.tsx
@@ -1,10 +1,10 @@
import {
ActivityChange,
ActivityLogItem,
+ ActivityLogUserName,
Description,
HumanizedChange,
defaultDescriber,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
interface CanvasPostHogCapabilities {
@@ -103,7 +103,7 @@ export function canvasActivityDescriber(logItem: ActivityLogItem, asNotification
return { description: null }
}
- const actor = <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>
+ const actor = <ActivityLogUserName logItem={logItem} />
const canvasName = <strong>{logItem.detail.name || 'Untitled canvas'}</strong>
if (logItem.activity === 'published') {
diff --git a/products/conversations/frontend/activityDescriber.tsx b/products/conversations/frontend/activityDescriber.tsx
index a282cc60b44c..503a79e65a01 100644
--- a/products/conversations/frontend/activityDescriber.tsx
+++ b/products/conversations/frontend/activityDescriber.tsx
@@ -1,11 +1,11 @@
import {
ActivityChange,
ActivityLogItem,
+ ActivityLogUserName,
ChangeMapping,
Description,
HumanizedChange,
defaultDescriber,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
import { TZLabel } from 'lib/components/TZLabel'
import { Link } from 'lib/lemon-ui/Link'
@@ -166,7 +166,7 @@ export function ticketActivityDescriber(logItem: ActivityLogItem, asNotification
trigger?.job_type === 'hog_flow' && trigger.job_id ? (
<WorkflowActivityLink id={trigger.job_id} />
) : (
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>
+ <ActivityLogUserName logItem={logItem} />
)
const ticketNumber = logItem.detail.name?.replace(/^Ticket #/, '')
const ticketLink = nameOrLinkToTicket(ticketNumber, logItem.detail.name)
diff --git a/products/data_warehouse/frontend/shared/components/activityDescriptions.tsx b/products/data_warehouse/frontend/shared/components/activityDescriptions.tsx
index 1c5c1bc1a36d..b0dcb72e61e8 100644
--- a/products/data_warehouse/frontend/shared/components/activityDescriptions.tsx
+++ b/products/data_warehouse/frontend/shared/components/activityDescriptions.tsx
@@ -1,8 +1,8 @@
import {
ActivityLogItem,
+ ActivityLogUserName,
HumanizedChange,
defaultDescriber,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
import { ActivityScope, DataWarehouseSyncInterval, ExternalDataSourceSyncSchema } from '~/types'
@@ -77,8 +77,7 @@ export function externalDataSourceActivityDescriber(
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> created schema{' '}
- <strong>{displayName}</strong>
+ <ActivityLogUserName logItem={logItem} /> created schema <strong>{displayName}</strong>
</>
),
}
@@ -86,8 +85,7 @@ export function externalDataSourceActivityDescriber(
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> created source{' '}
- <strong>{displayName}</strong>
+ <ActivityLogUserName logItem={logItem} /> created source <strong>{displayName}</strong>
</>
),
}
@@ -102,8 +100,7 @@ export function externalDataSourceActivityDescriber(
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> deleted schema{' '}
- <strong>{displayName}</strong>
+ <ActivityLogUserName logItem={logItem} /> deleted schema <strong>{displayName}</strong>
</>
),
}
@@ -111,8 +108,7 @@ export function externalDataSourceActivityDescriber(
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> deleted source{' '}
- <strong>{displayName}</strong>
+ <ActivityLogUserName logItem={logItem} /> deleted source <strong>{displayName}</strong>
</>
),
}
@@ -127,8 +123,7 @@ export function externalDataSourceActivityDescriber(
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> {verb} schema{' '}
- <strong>{displayName}</strong>
+ <ActivityLogUserName logItem={logItem} /> {verb} schema <strong>{displayName}</strong>
</>
),
}
@@ -136,8 +131,7 @@ export function externalDataSourceActivityDescriber(
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> updated schema{' '}
- <strong>{displayName}</strong>
+ <ActivityLogUserName logItem={logItem} /> updated schema <strong>{displayName}</strong>
</>
),
}
@@ -145,8 +139,7 @@ export function externalDataSourceActivityDescriber(
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> updated source{' '}
- <strong>{displayName}</strong>
+ <ActivityLogUserName logItem={logItem} /> updated source <strong>{displayName}</strong>
</>
),
}
diff --git a/products/endpoints/frontend/activityDescriber.tsx b/products/endpoints/frontend/activityDescriber.tsx
index 8e96800d2c72..3647f2424bb7 100644
--- a/products/endpoints/frontend/activityDescriber.tsx
+++ b/products/endpoints/frontend/activityDescriber.tsx
@@ -1,8 +1,8 @@
import {
ActivityLogItem,
+ ActivityLogUserName,
HumanizedChange,
defaultDescriber,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
import { Link } from 'lib/lemon-ui/Link'
import { urls } from 'scenes/urls'
@@ -37,8 +37,8 @@ export function endpointActivityDescriber(logItem: ActivityLogItem, asNotificati
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> created endpoint{' '}
- <EndpointLink name={endpointName} /> (<VersionLink name={endpointName} version={1} />
+ <ActivityLogUserName logItem={logItem} /> created endpoint <EndpointLink name={endpointName} /> (
+ <VersionLink name={endpointName} version={1} />
).
</>
),
@@ -49,8 +49,7 @@ export function endpointActivityDescriber(logItem: ActivityLogItem, asNotificati
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> deleted endpoint{' '}
- <strong>{endpointName}</strong>.
+ <ActivityLogUserName logItem={logItem} /> deleted endpoint <strong>{endpointName}</strong>.
</>
),
}
@@ -60,7 +59,7 @@ export function endpointActivityDescriber(logItem: ActivityLogItem, asNotificati
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> created version{' '}
+ <ActivityLogUserName logItem={logItem} /> created version{' '}
<VersionLink name={endpointName} version={version} /> of endpoint{' '}
<EndpointLink name={endpointName} />.
</>
@@ -72,7 +71,7 @@ export function endpointActivityDescriber(logItem: ActivityLogItem, asNotificati
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> updated{' '}
+ <ActivityLogUserName logItem={logItem} /> updated{' '}
<VersionLink name={endpointName} version={version} /> of endpoint{' '}
<EndpointLink name={endpointName} />.
</>
@@ -84,8 +83,7 @@ export function endpointActivityDescriber(logItem: ActivityLogItem, asNotificati
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> updated endpoint{' '}
- <EndpointLink name={endpointName} />.
+ <ActivityLogUserName logItem={logItem} /> updated endpoint <EndpointLink name={endpointName} />.
</>
),
}
diff --git a/products/error_tracking/frontend/components/ActivityDescriber.tsx b/products/error_tracking/frontend/components/ActivityDescriber.tsx
index 9483cf00ff35..59bdf39db1a8 100644
--- a/products/error_tracking/frontend/components/ActivityDescriber.tsx
+++ b/products/error_tracking/frontend/components/ActivityDescriber.tsx
@@ -6,11 +6,11 @@ import { Link } from '@posthog/lemon-ui'
import {
ActivityChange,
ActivityLogItem,
+ ActivityLogUserName,
ChangeMapping,
Description,
HumanizedChange,
defaultDescriber,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
import { SentenceList } from 'lib/components/ActivityLog/SentenceList'
import { objectsEqual } from 'lib/utils/objects'
@@ -162,7 +162,7 @@ export function ActivityDescriber(logItem: ActivityLogItem, asNotification?: boo
</>
),
]}
- prefix={<strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>}
+ prefix={<ActivityLogUserName logItem={logItem} />}
/>
),
}
@@ -192,12 +192,7 @@ export function ActivityDescriber(logItem: ActivityLogItem, asNotification?: boo
if (changes.length) {
return {
- description: (
- <SentenceList
- listParts={changes}
- prefix={<strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>}
- />
- ),
+ description: <SentenceList listParts={changes} prefix={<ActivityLogUserName logItem={logItem} />} />,
}
}
}
diff --git a/products/stamphog/frontend/activityDescriber.tsx b/products/stamphog/frontend/activityDescriber.tsx
index 56cef0bcc2b6..502153c2b8ce 100644
--- a/products/stamphog/frontend/activityDescriber.tsx
+++ b/products/stamphog/frontend/activityDescriber.tsx
@@ -1,10 +1,10 @@
import {
ActivityChange,
ActivityLogItem,
+ ActivityLogUserName,
Description,
HumanizedChange,
defaultDescriber,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
import { SentenceList } from 'lib/components/ActivityLog/SentenceList'
@@ -57,7 +57,7 @@ export function stamphogRepoConfigActivityDescriber(
return { description: null }
}
- const actor = <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong>
+ const actor = <ActivityLogUserName logItem={logItem} />
const repository = <strong>{logItem.detail.name || 'a repository'}</strong>
if (logItem.activity === 'created') {
diff --git a/products/workflows/frontend/Workflows/misc/workflowActivityDescriber.tsx b/products/workflows/frontend/Workflows/misc/workflowActivityDescriber.tsx
index abde592dbd8d..868e34f99bd2 100644
--- a/products/workflows/frontend/Workflows/misc/workflowActivityDescriber.tsx
+++ b/products/workflows/frontend/Workflows/misc/workflowActivityDescriber.tsx
@@ -1,8 +1,8 @@
import {
ActivityLogItem,
+ ActivityLogUserName,
HumanizedChange,
defaultDescriber,
- userNameForLogItem,
} from 'lib/components/ActivityLog/humanizeActivity'
import { Link } from 'lib/lemon-ui/Link'
import { urls } from 'scenes/urls'
@@ -89,7 +89,7 @@ export function workflowActivityDescriber(logItem: ActivityLogItem, asNotificati
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> created the {objectNoun}:{' '}
+ <ActivityLogUserName logItem={logItem} /> created the {objectNoun}:{' '}
{nameOrLinkToWorkflow(logItem?.item_id, logItem?.detail.name)}
</>
),
@@ -100,8 +100,7 @@ export function workflowActivityDescriber(logItem: ActivityLogItem, asNotificati
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> deleted the {objectNoun}:{' '}
- {logItem.detail.name}
+ <ActivityLogUserName logItem={logItem} /> deleted the {objectNoun}: {logItem.detail.name}
</>
),
}
@@ -111,9 +110,8 @@ export function workflowActivityDescriber(logItem: ActivityLogItem, asNotificati
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> restored a past version
- into the staged draft of the {objectNoun}:{' '}
- {nameOrLinkToWorkflow(logItem?.item_id, logItem?.detail.name)}
+ <ActivityLogUserName logItem={logItem} /> restored a past version into the staged draft of the{' '}
+ {objectNoun}: {nameOrLinkToWorkflow(logItem?.item_id, logItem?.detail.name)}
</>
),
}
@@ -123,8 +121,8 @@ export function workflowActivityDescriber(logItem: ActivityLogItem, asNotificati
return {
description: (
<>
- <strong className="ph-no-capture">{userNameForLogItem(logItem)}</strong> discarded the staged draft
- of the {objectNoun}: {nameOrLinkToWorkflow(logItem?.item_id, logItem?.detail.name)}
+ <ActivityLogUserName logItem={logItem} /> discarded the staged draft of the {objectNoun}:{' '}
+ {nameOrLinkToWorkflow(logItem?.item_id, logItem?.detail.name)}
</>
),
}
@@ -198,13 +196,12 @@ export function workflowActivityDescriber(logItem: ActivityLogItem, asNotificati
changes.push(<>updated {change.field}</>)
}
}
- const name = userNameForLogItem(logItem)
const workflowName = nameOrLinkToWorkflow(logItem?.item_id, logItem?.detail.name)
return {
description: (
<div>
- <strong className="ph-no-capture">{name}</strong> {verb} the {objectNoun}: {workflowName}
+ <ActivityLogUserName logItem={logItem} /> {verb} the {objectNoun}: {workflowName}
<ul className="ml-5 list-disc">
{changes.map((c, i) => (
<li key={i}>{c}</li>