From 957d3d3c092ea9efdd2dd0f2d375fbddbbcc9e61 Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 2 Feb 2026 21:22:54 +0000 Subject: [PATCH] fix: fallback to email when user name is missing in activity list --- .../views/card/components/ActivityList.tsx | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/apps/web/src/views/card/components/ActivityList.tsx b/apps/web/src/views/card/components/ActivityList.tsx index a1dd8a4f..5102a927 100644 --- a/apps/web/src/views/card/components/ActivityList.tsx +++ b/apps/web/src/views/card/components/ActivityList.tsx @@ -36,12 +36,21 @@ const truncate = (value: string | null, maxLength = 50) => { return value.length > maxLength ? `${value.slice(0, maxLength - 1)}…` : value; }; +const getUserDisplayName = ( + user: { name?: string | null; email?: string | null } | null | undefined, +): string => { + if (user?.name?.trim()) return user.name; + if (user?.email) return user.email; + return t`Member`; +}; + const getActivityText = ({ type, toTitle, fromList, toList, memberName, + memberEmail, isSelf, label, fromTitle, @@ -54,6 +63,7 @@ const getActivityText = ({ fromList: string | null; toList: string | null; memberName: string | null; + memberEmail: string | null; isSelf: boolean; label: string | null; fromTitle?: string | null; @@ -62,6 +72,7 @@ const getActivityText = ({ dateLocale: DateFnsLocale; mergedLabels?: string[]; }) => { + const displayName = memberName ?? memberEmail ?? t`Member`; const TextHighlight = ({ children }: { children: React.ReactNode }) => ( {children} @@ -139,23 +150,23 @@ const getActivityText = ({ ); } - if (type === "card.updated.member.added" && memberName) { + if (type === "card.updated.member.added" && displayName) { if (isSelf) return self-assigned the card; return ( - assigned {truncate(memberName)} to the + assigned {truncate(displayName)} to the card ); } - if (type === "card.updated.member.removed" && memberName) { + if (type === "card.updated.member.removed" && displayName) { if (isSelf) return unassigned themselves from the card; return ( - unassigned {truncate(memberName)} from + unassigned {truncate(displayName)} from the card ); @@ -455,6 +466,7 @@ const ActivityList = ({ fromList: activity.fromList?.name ?? null, toList: activity.toList?.name ?? null, memberName: activity.member?.user?.name ?? null, + memberEmail: activity.member?.user?.email ?? null, isSelf: activity.member?.user?.id === sessionData?.user.id, label: activity.label?.name ?? null, fromTitle: activity.fromTitle ?? null, @@ -508,7 +520,7 @@ const ActivityList = ({ )}

- {`${activity.user?.name} `} + {`${getUserDisplayName(activity.user)} `} {activityText}