From ce4849371da1d9415dfc87a643d74909087c6e37 Mon Sep 17 00:00:00 2001 From: Ben White Date: Thu, 21 Dec 2023 16:39:25 +0100 Subject: [PATCH] feat: Added last_name field (#19463) --- .../__snapshots__/test_time_to_see_data.ambr | 1 + .../components/MinimalNavigation.tsx | 2 +- .../navigation-3000/components/Navbar.tsx | 2 +- .../Breadcrumbs/breadcrumbsLogic.tsx | 2 +- .../layout/navigation/TopBar/SitePopover.tsx | 4 ++-- .../components/ActivityLog/ActivityLog.tsx | 6 ++++-- .../ActivityLog/humanizeActivity.tsx | 5 +++-- .../AnnotationsOverlay/AnnotationsOverlay.tsx | 5 +++-- .../Cards/InsightCard/InsightDetails.tsx | 10 ++------- .../CommandPalette/commandPaletteLogic.tsx | 4 +--- .../DefinitionPopover/DefinitionPopover.tsx | 2 +- frontend/src/lib/components/MemberSelect.tsx | 13 ++++-------- frontend/src/lib/components/Table/Table.tsx | 4 +--- .../UserActivityIndicator.tsx | 2 +- .../src/lib/components/UserSelectItem.tsx | 2 +- .../LemonSelectMultiple.stories.tsx | 8 ++++++- .../LemonSnack/LemonSnack.stories.tsx | 2 +- .../lib/lemon-ui/LemonTable/columnUtils.tsx | 4 +--- .../ProfilePicture/ProfileBubbles.tsx | 6 ++++-- .../ProfilePicture/ProfilePicture.tsx | 21 ++++++++++++++----- frontend/src/lib/utils.tsx | 4 ++++ .../nodes/TimeToSeeData/Trace/traceLogic.tsx | 2 +- .../src/scenes/annotations/Annotations.tsx | 3 +-- .../scenes/authentication/InviteSignup.tsx | 2 +- .../dashboard/DashboardCollaborators.tsx | 2 +- .../instance/SystemStatus/StaffUsersTab.tsx | 2 +- .../notebooks/Nodes/NotebookNodeMention.tsx | 2 +- .../notebooks/Notebook/MentionsExtension.tsx | 2 +- .../notebooks/Notebook/NotebookHistory.tsx | 6 ++++-- .../NotebookSelectButton.tsx | 3 +-- frontend/src/scenes/persons/PersonDisplay.tsx | 12 +++++++++-- .../scenes/settings/organization/Invites.tsx | 2 +- .../scenes/settings/organization/Members.tsx | 13 ++++++------ .../Permissions/Roles/CreateRoleModal.tsx | 2 +- .../settings/project/ProjectAccessControl.tsx | 2 +- frontend/src/types.ts | 1 + posthog/api/shared.py | 1 + .../dashboards/test_dashboard_text_tiles.py | 1 + posthog/api/test/test_insight.py | 2 ++ .../test/test_organization_feature_flag.py | 1 + posthog/api/test/test_organization_invites.py | 1 + posthog/api/test/test_organization_members.py | 1 + posthog/api/test/test_signup.py | 6 ++++++ posthog/api/user.py | 1 + 44 files changed, 107 insertions(+), 72 deletions(-) diff --git a/ee/api/test/__snapshots__/test_time_to_see_data.ambr b/ee/api/test/__snapshots__/test_time_to_see_data.ambr index 9458103ac1e18..48bec559c2d19 100644 --- a/ee/api/test/__snapshots__/test_time_to_see_data.ambr +++ b/ee/api/test/__snapshots__/test_time_to_see_data.ambr @@ -17,6 +17,7 @@ "user": { "distinct_id": "", "first_name": "", + "last_name": "", "email": "", "is_email_verified": false } diff --git a/frontend/src/layout/navigation-3000/components/MinimalNavigation.tsx b/frontend/src/layout/navigation-3000/components/MinimalNavigation.tsx index 1161a4dadc1c8..cf0e586b6192a 100644 --- a/frontend/src/layout/navigation-3000/components/MinimalNavigation.tsx +++ b/frontend/src/layout/navigation-3000/components/MinimalNavigation.tsx @@ -51,7 +51,7 @@ export function MinimalNavigation(): JSX.Element { } + icon={} onClick={toggleSitePopover} > {user?.first_name || user?.email} diff --git a/frontend/src/layout/navigation-3000/components/Navbar.tsx b/frontend/src/layout/navigation-3000/components/Navbar.tsx index 3ca2e1690fe4f..6fbae5671a9c3 100644 --- a/frontend/src/layout/navigation-3000/components/Navbar.tsx +++ b/frontend/src/layout/navigation-3000/components/Navbar.tsx @@ -107,7 +107,7 @@ export function Navbar(): JSX.Element { className="min-w-70" > } + icon={} identifier="me" title={`Hi${user?.first_name ? `, ${user?.first_name}` : ''}!`} shortTitle={user?.first_name || user?.email} diff --git a/frontend/src/layout/navigation/Breadcrumbs/breadcrumbsLogic.tsx b/frontend/src/layout/navigation/Breadcrumbs/breadcrumbsLogic.tsx index 2b40103a7454c..ec769563d9777 100644 --- a/frontend/src/layout/navigation/Breadcrumbs/breadcrumbsLogic.tsx +++ b/frontend/src/layout/navigation/Breadcrumbs/breadcrumbsLogic.tsx @@ -114,7 +114,7 @@ export const breadcrumbsLogic = kea([ breadcrumbs.push({ key: 'me', name: user.first_name, - symbol: , + symbol: , }) } // Instance diff --git a/frontend/src/layout/navigation/TopBar/SitePopover.tsx b/frontend/src/layout/navigation/TopBar/SitePopover.tsx index 4bfbd77cd8c9e..8a9191048b95f 100644 --- a/frontend/src/layout/navigation/TopBar/SitePopover.tsx +++ b/frontend/src/layout/navigation/TopBar/SitePopover.tsx @@ -74,7 +74,7 @@ function AccountInfo(): JSX.Element { tooltipPlacement="left" sideIcon={} > - +
{user?.first_name}
@@ -320,7 +320,7 @@ export function SitePopover(): JSX.Element { >
- + {!systemStatusHealthy && }
diff --git a/frontend/src/lib/components/ActivityLog/ActivityLog.tsx b/frontend/src/lib/components/ActivityLog/ActivityLog.tsx index 52834f7479876..fe00761d2fa49 100644 --- a/frontend/src/lib/components/ActivityLog/ActivityLog.tsx +++ b/frontend/src/lib/components/ActivityLog/ActivityLog.tsx @@ -73,9 +73,11 @@ export const ActivityLogRow = ({
diff --git a/frontend/src/lib/components/ActivityLog/humanizeActivity.tsx b/frontend/src/lib/components/ActivityLog/humanizeActivity.tsx index e1dc145a86a8b..28bdb6b4aa784 100644 --- a/frontend/src/lib/components/ActivityLog/humanizeActivity.tsx +++ b/frontend/src/lib/components/ActivityLog/humanizeActivity.tsx @@ -1,4 +1,5 @@ import { dayjs } from 'lib/dayjs' +import { fullName } from 'lib/utils' import { InsightShortId, PersonType } from '~/types' @@ -110,7 +111,7 @@ export function humanize( if (description !== null) { logLines.push({ email: logItem.user?.email, - name: logItem.user?.first_name, + name: logItem.user ? fullName(logItem.user) : undefined, isSystem: logItem.is_system, description, extendedDescription, @@ -126,5 +127,5 @@ export function userNameForLogItem(logItem: ActivityLogItem): string { if (logItem.is_system) { return 'PostHog' } - return logItem.user?.first_name ?? 'A user' + return logItem.user ? fullName(logItem.user) : 'A user' } diff --git a/frontend/src/lib/components/AnnotationsOverlay/AnnotationsOverlay.tsx b/frontend/src/lib/components/AnnotationsOverlay/AnnotationsOverlay.tsx index 3f43c79ca46d0..dd8731af9c5b4 100644 --- a/frontend/src/lib/components/AnnotationsOverlay/AnnotationsOverlay.tsx +++ b/frontend/src/lib/components/AnnotationsOverlay/AnnotationsOverlay.tsx @@ -258,8 +258,9 @@ function AnnotationCard({ annotation }: { annotation: AnnotationType }): JSX.Ele
{annotation.content}
Created by
- {' '} - +
Last modified by
- {' '} + {' '}
diff --git a/frontend/src/lib/components/CommandPalette/commandPaletteLogic.tsx b/frontend/src/lib/components/CommandPalette/commandPaletteLogic.tsx index 27eaae39e8774..f9b9157c2959b 100644 --- a/frontend/src/lib/components/CommandPalette/commandPaletteLogic.tsx +++ b/frontend/src/lib/components/CommandPalette/commandPaletteLogic.tsx @@ -689,9 +689,7 @@ export const commandPaletteLogic = kea([ }, }, { - icon: () => ( - - ), + icon: () => , display: 'Go to User settings', synonyms: ['account', 'profile'], executor: () => { diff --git a/frontend/src/lib/components/DefinitionPopover/DefinitionPopover.tsx b/frontend/src/lib/components/DefinitionPopover/DefinitionPopover.tsx index 118327650e662..bd250bfe90adb 100644 --- a/frontend/src/lib/components/DefinitionPopover/DefinitionPopover.tsx +++ b/frontend/src/lib/components/DefinitionPopover/DefinitionPopover.tsx @@ -185,7 +185,7 @@ function Owner({ user }: { user?: UserBasicType | null }): JSX.Element { <> {user?.uuid ? (
- + {user.first_name}
) : ( diff --git a/frontend/src/lib/components/MemberSelect.tsx b/frontend/src/lib/components/MemberSelect.tsx index a1cb6e1899c92..3ab1d0a793662 100644 --- a/frontend/src/lib/components/MemberSelect.tsx +++ b/frontend/src/lib/components/MemberSelect.tsx @@ -1,5 +1,6 @@ import { LemonButton, LemonButtonProps, LemonDropdown, LemonInput, ProfilePicture } from '@posthog/lemon-ui' import { useValues } from 'kea' +import { fullName } from 'lib/utils' import { useMemo, useState } from 'react' import { membersLogic } from 'scenes/organization/membersLogic' @@ -79,17 +80,11 @@ export function MemberSelect({ fullWidth role="menuitem" size="small" - icon={ - - } + icon={} onClick={() => _onChange(member.user)} > - {member.user.first_name} + {fullName(member.user)} {meFirstMembers[0] === member && `(you)`} @@ -112,7 +107,7 @@ export function MemberSelect({ selectedMember ) : selectedMember ? ( - {selectedMember.first_name} + {fullName(selectedMember)} {meFirstMembers[0].user.uuid === selectedMember.uuid ? ` (you)` : ''} ) : ( diff --git a/frontend/src/lib/components/Table/Table.tsx b/frontend/src/lib/components/Table/Table.tsx index 7cf69790d2763..afcecc0eb15c9 100644 --- a/frontend/src/lib/components/Table/Table.tsx +++ b/frontend/src/lib/components/Table/Table.tsx @@ -31,9 +31,7 @@ export function createdByColumn = Record - {item.created_by && ( - - )} + {item.created_by && } {/* eslint-disable-next-line react/forbid-dom-props */}
{item.created_by ? item.created_by.first_name || item.created_by.email : '-'} diff --git a/frontend/src/lib/components/UserActivityIndicator/UserActivityIndicator.tsx b/frontend/src/lib/components/UserActivityIndicator/UserActivityIndicator.tsx index cd5f5cd1e2d70..8f8e602b6103f 100644 --- a/frontend/src/lib/components/UserActivityIndicator/UserActivityIndicator.tsx +++ b/frontend/src/lib/components/UserActivityIndicator/UserActivityIndicator.tsx @@ -27,7 +27,7 @@ export function UserActivityIndicator({ {at && } {by && by}
- {by && } + {by && }
) : null } diff --git a/frontend/src/lib/components/UserSelectItem.tsx b/frontend/src/lib/components/UserSelectItem.tsx index 0732418c35479..7990f4c8a7301 100644 --- a/frontend/src/lib/components/UserSelectItem.tsx +++ b/frontend/src/lib/components/UserSelectItem.tsx @@ -10,7 +10,7 @@ export interface UserSelectItemProps { export function UserSelectItem({ user }: UserSelectItemProps): JSX.Element { return ( - + {user.first_name} {`<${user.email}>`} diff --git a/frontend/src/lib/lemon-ui/LemonSelectMultiple/LemonSelectMultiple.stories.tsx b/frontend/src/lib/lemon-ui/LemonSelectMultiple/LemonSelectMultiple.stories.tsx index c360b9f86e796..baa2f805f48e4 100644 --- a/frontend/src/lib/lemon-ui/LemonSelectMultiple/LemonSelectMultiple.stories.tsx +++ b/frontend/src/lib/lemon-ui/LemonSelectMultiple/LemonSelectMultiple.stories.tsx @@ -16,7 +16,13 @@ const meta: Meta = { [`user-${i}`]: { labelComponent: ( - + {capitalizeFirstLetter(x)} {`<${x}@posthog.com>`} diff --git a/frontend/src/lib/lemon-ui/LemonSnack/LemonSnack.stories.tsx b/frontend/src/lib/lemon-ui/LemonSnack/LemonSnack.stories.tsx index e7e2c9528687d..cffe497f947bb 100644 --- a/frontend/src/lib/lemon-ui/LemonSnack/LemonSnack.stories.tsx +++ b/frontend/src/lib/lemon-ui/LemonSnack/LemonSnack.stories.tsx @@ -44,7 +44,7 @@ export const ComplexContent: Story = BasicTemplate.bind({}) ComplexContent.args = { children: ( - + Look at me I'm bold! diff --git a/frontend/src/lib/lemon-ui/LemonTable/columnUtils.tsx b/frontend/src/lib/lemon-ui/LemonTable/columnUtils.tsx index 935dc5500b9ef..b258ba98de193 100644 --- a/frontend/src/lib/lemon-ui/LemonTable/columnUtils.tsx +++ b/frontend/src/lib/lemon-ui/LemonTable/columnUtils.tsx @@ -39,9 +39,7 @@ export function createdByColumn const { created_by } = item return (
- {created_by && ( - - )} + {created_by && }
) }, diff --git a/frontend/src/lib/lemon-ui/ProfilePicture/ProfileBubbles.tsx b/frontend/src/lib/lemon-ui/ProfilePicture/ProfileBubbles.tsx index 23cd6b167efeb..0da16a220f548 100644 --- a/frontend/src/lib/lemon-ui/ProfilePicture/ProfileBubbles.tsx +++ b/frontend/src/lib/lemon-ui/ProfilePicture/ProfileBubbles.tsx @@ -29,8 +29,10 @@ export function ProfileBubbles({ people, tooltip, limit = 6, ...divProps }: Prof {shownPeople.map(({ email, name, title }, index) => ( , 'first_name' | 'email' | 'last_name'> | null name?: string - email?: string size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl' showName?: boolean className?: string @@ -22,8 +24,8 @@ export interface ProfilePictureProps { } export function ProfilePicture({ + user, name, - email, size = 'lg', showName, className, @@ -31,9 +33,16 @@ export function ProfilePicture({ title, type = 'person', }: ProfilePictureProps): JSX.Element { - const { user } = useValues(userLogic) + const { user: currentUser } = useValues(userLogic) const [gravatarLoaded, setGravatarLoaded] = useState() + let email = user?.email + + if (user) { + name = fullName(user) + email = user.email + } + const combinedNameAndEmail = name && email ? `${name} <${email}>` : name || email const gravatarUrl = useMemo(() => { @@ -82,7 +91,9 @@ export function ProfilePicture({ ) : (
{pictureComponent} - {user?.email === email ? 'you' : name || email || 'an unknown user'} + + {currentUser?.email === email ? 'you' : name || email || 'an unknown user'} +
) } diff --git a/frontend/src/lib/utils.tsx b/frontend/src/lib/utils.tsx index 4477d4d3ab553..7e73d58fc2d0f 100644 --- a/frontend/src/lib/utils.tsx +++ b/frontend/src/lib/utils.tsx @@ -191,6 +191,10 @@ export function capitalizeFirstLetter(string: string): string { return string.charAt(0).toUpperCase() + string.slice(1) } +export function fullName(props: { first_name?: string; last_name?: string }): string { + return `${props.first_name || ''} ${props.last_name || ''}`.trim() +} + export const genericOperatorMap: Record = { exact: '= equals', is_not: "≠ doesn't equal", diff --git a/frontend/src/queries/nodes/TimeToSeeData/Trace/traceLogic.tsx b/frontend/src/queries/nodes/TimeToSeeData/Trace/traceLogic.tsx index c36416b2fe033..232748290d242 100644 --- a/frontend/src/queries/nodes/TimeToSeeData/Trace/traceLogic.tsx +++ b/frontend/src/queries/nodes/TimeToSeeData/Trace/traceLogic.tsx @@ -21,7 +21,7 @@ export function sessionNodeFacts(node: TimeToSeeNode): Record, + user: , duration: humanFriendlyMilliseconds(node.data.duration_ms) || 'unknown', sessionEventCount: node.data.events_count, frustratingInteractions: node.data.frustrating_interactions_count, diff --git a/frontend/src/scenes/annotations/Annotations.tsx b/frontend/src/scenes/annotations/Annotations.tsx index 90762f8c3bc81..110d8794fd0b1 100644 --- a/frontend/src/scenes/annotations/Annotations.tsx +++ b/frontend/src/scenes/annotations/Annotations.tsx @@ -102,8 +102,7 @@ export function Annotations(): JSX.Element { return (
- +
{user.first_name}
{user.organization?.name}
diff --git a/frontend/src/scenes/dashboard/DashboardCollaborators.tsx b/frontend/src/scenes/dashboard/DashboardCollaborators.tsx index 3f43a36e43d42..bb61ce0f55110 100644 --- a/frontend/src/scenes/dashboard/DashboardCollaborators.tsx +++ b/frontend/src/scenes/dashboard/DashboardCollaborators.tsx @@ -121,7 +121,7 @@ function CollaboratorRow({ return (
- + + return }, width: 32, }, diff --git a/frontend/src/scenes/notebooks/Nodes/NotebookNodeMention.tsx b/frontend/src/scenes/notebooks/Nodes/NotebookNodeMention.tsx index e446a8b302fce..b2dc3441b6136 100644 --- a/frontend/src/scenes/notebooks/Nodes/NotebookNodeMention.tsx +++ b/frontend/src/scenes/notebooks/Nodes/NotebookNodeMention.tsx @@ -22,7 +22,7 @@ const Component = (props: NodeViewProps): JSX.Element => { - +
{member?.user.first_name}
{member?.user.email}
diff --git a/frontend/src/scenes/notebooks/Notebook/MentionsExtension.tsx b/frontend/src/scenes/notebooks/Notebook/MentionsExtension.tsx index d5c98de3f94ac..eafec59d4c0cb 100644 --- a/frontend/src/scenes/notebooks/Notebook/MentionsExtension.tsx +++ b/frontend/src/scenes/notebooks/Notebook/MentionsExtension.tsx @@ -121,7 +121,7 @@ export const Mentions = forwardRef(function SlashCom key={member.id} fullWidth status="primary-alt" - icon={} + icon={} active={index === selectedIndex} onClick={() => void execute(member)} > diff --git a/frontend/src/scenes/notebooks/Notebook/NotebookHistory.tsx b/frontend/src/scenes/notebooks/Notebook/NotebookHistory.tsx index 702182c5a05fe..3f72641d328e0 100644 --- a/frontend/src/scenes/notebooks/Notebook/NotebookHistory.tsx +++ b/frontend/src/scenes/notebooks/Notebook/NotebookHistory.tsx @@ -51,9 +51,11 @@ function NotebookHistoryList({ onItemClick }: { onItemClick: (logItem: ActivityL const buttonContent = ( diff --git a/frontend/src/scenes/notebooks/NotebookSelectButton/NotebookSelectButton.tsx b/frontend/src/scenes/notebooks/NotebookSelectButton/NotebookSelectButton.tsx index 7dcf4b57e3088..48be40ae066bb 100644 --- a/frontend/src/scenes/notebooks/NotebookSelectButton/NotebookSelectButton.tsx +++ b/frontend/src/scenes/notebooks/NotebookSelectButton/NotebookSelectButton.tsx @@ -57,8 +57,7 @@ function NotebooksChoiceList(props: { sideIcon={ notebook.created_by ? ( `} /> diff --git a/frontend/src/scenes/persons/PersonDisplay.tsx b/frontend/src/scenes/persons/PersonDisplay.tsx index 98b349859b245..f8dea0bd46fdf 100644 --- a/frontend/src/scenes/persons/PersonDisplay.tsx +++ b/frontend/src/scenes/persons/PersonDisplay.tsx @@ -30,7 +30,7 @@ export interface PersonDisplayProps { export function PersonIcon({ person, ...props -}: Pick & Omit): JSX.Element { +}: Pick & Omit): JSX.Element { const display = asDisplay(person) const email: string | undefined = useMemo(() => { @@ -41,7 +41,15 @@ export function PersonIcon({ return typeof possibleEmail === 'string' ? possibleEmail : undefined }, [person?.properties?.email]) - return + return ( + + ) } export function PersonDisplay({ diff --git a/frontend/src/scenes/settings/organization/Invites.tsx b/frontend/src/scenes/settings/organization/Invites.tsx index 132184c745226..823f24997fb14 100644 --- a/frontend/src/scenes/settings/organization/Invites.tsx +++ b/frontend/src/scenes/settings/organization/Invites.tsx @@ -62,7 +62,7 @@ export function Invites(): JSX.Element { { key: 'user_profile_picture', render: function ProfilePictureRender(_, invite) { - return + return }, width: 32, }, diff --git a/frontend/src/scenes/settings/organization/Members.tsx b/frontend/src/scenes/settings/organization/Members.tsx index c892bbd7dc4e9..ae4a31509a537 100644 --- a/frontend/src/scenes/settings/organization/Members.tsx +++ b/frontend/src/scenes/settings/organization/Members.tsx @@ -10,6 +10,7 @@ import { LemonTable, LemonTableColumns } from 'lib/lemon-ui/LemonTable' import { LemonTag } from 'lib/lemon-ui/LemonTag/LemonTag' import { ProfilePicture } from 'lib/lemon-ui/ProfilePicture' import { Tooltip } from 'lib/lemon-ui/Tooltip' +import { fullName } from 'lib/utils' import { getReasonForAccessLevelChangeProhibition, membershipLevelToName, @@ -68,7 +69,7 @@ function ActionsComponent(_: any, member: OrganizationMemberType): JSX.Element | } if (listLevel === OrganizationMembershipLevel.Owner) { LemonDialog.open({ - title: `Transfer organization ownership to ${member.user.first_name}?`, + title: `Transfer organization ownership to ${fullName(member.user)}?`, description: `You will no longer be the owner of ${user.organization?.name}. After the transfer you will become an administrator.`, primaryButton: { status: 'danger', @@ -109,7 +110,7 @@ function ActionsComponent(_: any, member: OrganizationMemberType): JSX.Element | title: `${ member.user.uuid == user.uuid ? 'Leave' - : `Remove ${member.user.first_name} from` + : `Remove ${fullName(member.user)} from` } organization ${user.organization?.name}?`, primaryButton: { children: member.user.uuid == user.uuid ? 'Leave' : 'Remove', @@ -150,16 +151,16 @@ export function Members(): JSX.Element | null { { key: 'user_profile_picture', render: function ProfilePictureRender(_, member) { - return + return }, width: 32, }, { title: 'Name', - key: 'user_first_name', + key: 'user_name', render: (_, member) => - member.user.uuid == user.uuid ? `${member.user.first_name} (me)` : member.user.first_name, - sorter: (a, b) => a.user.first_name.localeCompare(b.user.first_name), + member.user.uuid == user.uuid ? `${fullName(member.user)} (me)` : fullName(member.user), + sorter: (a, b) => fullName(a.user).localeCompare(fullName(b.user)), }, { title: 'Email', diff --git a/frontend/src/scenes/settings/organization/Permissions/Roles/CreateRoleModal.tsx b/frontend/src/scenes/settings/organization/Permissions/Roles/CreateRoleModal.tsx index 3311cc1833117..fc2d6571dbf2d 100644 --- a/frontend/src/scenes/settings/organization/Permissions/Roles/CreateRoleModal.tsx +++ b/frontend/src/scenes/settings/organization/Permissions/Roles/CreateRoleModal.tsx @@ -154,7 +154,7 @@ function MemberRow({ return (
- + {isAdminOrOwner && deleteMember && ( } diff --git a/frontend/src/scenes/settings/project/ProjectAccessControl.tsx b/frontend/src/scenes/settings/project/ProjectAccessControl.tsx index b34d3a52fd94c..ff18dd636e143 100644 --- a/frontend/src/scenes/settings/project/ProjectAccessControl.tsx +++ b/frontend/src/scenes/settings/project/ProjectAccessControl.tsx @@ -140,7 +140,7 @@ export function ProjectTeamMembers(): JSX.Element | null { { key: 'user_profile_picture', render: function ProfilePictureRender(_, member) { - return + return }, width: 32, }, diff --git a/frontend/src/types.ts b/frontend/src/types.ts index 31fd16548269b..3053e08502407 100644 --- a/frontend/src/types.ts +++ b/frontend/src/types.ts @@ -147,6 +147,7 @@ interface UserBaseType { uuid: string distinct_id: string first_name: string + last_name?: string email: string } diff --git a/posthog/api/shared.py b/posthog/api/shared.py index 1a497278b68d0..0ea32d6582330 100644 --- a/posthog/api/shared.py +++ b/posthog/api/shared.py @@ -18,6 +18,7 @@ class Meta: "uuid", "distinct_id", "first_name", + "last_name", "email", "is_email_verified", ] diff --git a/posthog/api/test/dashboards/test_dashboard_text_tiles.py b/posthog/api/test/dashboards/test_dashboard_text_tiles.py index 509c7b0b9f36a..3bf802f18be6b 100644 --- a/posthog/api/test/dashboards/test_dashboard_text_tiles.py +++ b/posthog/api/test/dashboards/test_dashboard_text_tiles.py @@ -24,6 +24,7 @@ def _serialised_user(user: Optional[User]) -> Optional[Dict[str, Optional[Union[ "distinct_id": user.distinct_id, "email": user.email, "first_name": "", + "last_name": "", "id": user.id, "uuid": str(user.uuid), "is_email_verified": None, diff --git a/posthog/api/test/test_insight.py b/posthog/api/test/test_insight.py index c3ddb7e3b5dfd..5710513597f6b 100644 --- a/posthog/api/test/test_insight.py +++ b/posthog/api/test/test_insight.py @@ -76,6 +76,7 @@ def test_created_updated_and_last_modified(self) -> None: "uuid": str(self.user.uuid), "distinct_id": self.user.distinct_id, "first_name": self.user.first_name, + "last_name": self.user.last_name, "email": self.user.email, "is_email_verified": None, } @@ -84,6 +85,7 @@ def test_created_updated_and_last_modified(self) -> None: "uuid": str(alt_user.uuid), "distinct_id": alt_user.distinct_id, "first_name": alt_user.first_name, + "last_name": alt_user.last_name, "email": alt_user.email, "is_email_verified": None, } diff --git a/posthog/api/test/test_organization_feature_flag.py b/posthog/api/test/test_organization_feature_flag.py index 78e72269b20bb..90576b688aa75 100644 --- a/posthog/api/test/test_organization_feature_flag.py +++ b/posthog/api/test/test_organization_feature_flag.py @@ -50,6 +50,7 @@ def test_get_feature_flag_success(self): "uuid": str(self.user.uuid), "distinct_id": self.user.distinct_id, "first_name": self.user.first_name, + "last_name": self.user.last_name, "email": self.user.email, "is_email_verified": self.user.is_email_verified, }, diff --git a/posthog/api/test/test_organization_invites.py b/posthog/api/test/test_organization_invites.py index 0e52252781963..6d8c9d3a11fc5 100644 --- a/posthog/api/test/test_organization_invites.py +++ b/posthog/api/test/test_organization_invites.py @@ -88,6 +88,7 @@ def test_add_organization_invite_with_email(self, mock_capture): "distinct_id": self.user.distinct_id, "email": self.user.email, "first_name": self.user.first_name, + "last_name": self.user.last_name, "is_email_verified": self.user.is_email_verified, }, "is_expired": False, diff --git a/posthog/api/test/test_organization_members.py b/posthog/api/test/test_organization_members.py index 2416e5552fa9a..132f9a5c4ebe8 100644 --- a/posthog/api/test/test_organization_members.py +++ b/posthog/api/test/test_organization_members.py @@ -97,6 +97,7 @@ def test_change_organization_member_level(self): "uuid": str(user.uuid), "distinct_id": str(user.distinct_id), "first_name": user.first_name, + "last_name": user.last_name, "email": user.email, "is_email_verified": None, }, diff --git a/posthog/api/test/test_signup.py b/posthog/api/test/test_signup.py index 00c101e4487ee..d4e71415b4569 100644 --- a/posthog/api/test/test_signup.py +++ b/posthog/api/test/test_signup.py @@ -62,6 +62,7 @@ def test_api_sign_up(self, mock_capture): "id": user.pk, "uuid": str(user.uuid), "distinct_id": user.distinct_id, + "last_name": "", "first_name": "John", "email": "hedgehog@posthog.com", "redirect_url": "/", @@ -210,6 +211,7 @@ def test_signup_minimum_attrs(self, mock_capture): "id": user.pk, "uuid": str(user.uuid), "distinct_id": user.distinct_id, + "last_name": "", "first_name": "Jane", "email": "hedgehog2@posthog.com", "redirect_url": "/", @@ -364,6 +366,7 @@ def test_default_dashboard_is_created_on_signup(self): "id": user.pk, "uuid": str(user.uuid), "distinct_id": user.distinct_id, + "last_name": "", "first_name": "Jane", "email": "hedgehog75@posthog.com", "redirect_url": "/", @@ -868,6 +871,7 @@ def test_api_invite_sign_up(self, mock_capture): "id": user.pk, "uuid": str(user.uuid), "distinct_id": user.distinct_id, + "last_name": "", "first_name": "Alice", "email": "test+99@posthog.com", "redirect_url": "/", @@ -1076,6 +1080,7 @@ def test_existing_user_can_sign_up_to_a_new_organization(self, mock_update_disti "id": user.pk, "uuid": str(user.uuid), "distinct_id": user.distinct_id, + "last_name": "", "first_name": "", "email": "test+159@posthog.com", "redirect_url": "/", @@ -1151,6 +1156,7 @@ def test_cannot_use_claim_invite_endpoint_to_update_user(self, mock_capture): "id": user.pk, "uuid": str(user.uuid), "distinct_id": user.distinct_id, + "last_name": "", "first_name": "", "email": "test+189@posthog.com", "redirect_url": "/", diff --git a/posthog/api/user.py b/posthog/api/user.py index c7c1813b8b38f..26e887237906b 100644 --- a/posthog/api/user.py +++ b/posthog/api/user.py @@ -89,6 +89,7 @@ class Meta: "uuid", "distinct_id", "first_name", + "last_name", "email", "pending_email", "email_opt_in",