Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

display full email names for threads with single participants (#678)

Peter Chinmanda82e582eb0d
diff --git a/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx b/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx
index e8af38f9e6..14a391ee07 100644
--- a/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx
+++ b/js/app/packages/macro-entity/src/components/EntityWithEverything.tsx
@@ -458,7 +458,7 @@ export function EntityWithEverything(
const isLikelyEmail = (value?: string) =>
typeof value === 'string' && value.includes('@');
- const combinedParticipantFirstNames = createMemo(() => {
+ const combinedParticipantNames = createMemo(() => {
if (props.entity.type !== 'email') return [];
const me = userEmail();
if (
@@ -475,15 +475,14 @@ export function EntityWithEverything(
const macroDisplayName = useDisplayName(
emailToId(participant.email)
)[0]?.();
- const macroFirstName = macroDisplayName?.split(' ')[0];
- const participantFirstName = participant.name?.split(' ')[0] ?? '';
- if (macroFirstName && !isLikelyEmail(macroFirstName)) {
- namesSet.add(macroFirstName);
+ const participantFullName = participant.name ?? '';
+ if (macroDisplayName && !isLikelyEmail(macroDisplayName)) {
+ namesSet.add(macroDisplayName);
} else if (
- participantFirstName &&
- !isLikelyEmail(participantFirstName)
+ participantFullName &&
+ !isLikelyEmail(participantFullName)
) {
- namesSet.add(participantFirstName);
+ namesSet.add(participantFullName);
} else {
const emailName = participant.email.split('@')[0];
namesSet.add(emailName);
@@ -493,10 +492,13 @@ export function EntityWithEverything(
});
const displayedNames = () => {
- const names = combinedParticipantFirstNames();
+ const names = combinedParticipantNames();
if (!names || names.length === 0) return undefined;
- if (names.length <= 3) return names.join(', ');
- return `${names[0]} .. ${names[names.length - 2]}, ${names[names.length - 1]}`;
+ if (names.length === 1) return names[0];
+ // For multiple participants, use first names only
+ const firstNames = names.map((name) => name.split(' ')[0]);
+ if (firstNames.length <= 3) return firstNames.join(', ');
+ return `${firstNames[0]} .. ${firstNames[firstNames.length - 2]}, ${firstNames[firstNames.length - 1]}`;
};
const isSearch = () => isSearchEntity(props.entity);