Add record chip for sender and add receivers (#3629)
* Add record chip for sender and add receivers * Build enum for roles * Rename var and use string literal --------- Co-authored-by: Thomas Trompette <thomast@twenty.com>
This commit is contained in:
@ -0,0 +1,35 @@
|
||||
import { EmailThreadMessageParticipant } from '@/activities/emails/types/EmailThreadMessageParticipant';
|
||||
|
||||
export const getDisplayNameFromParticipant = ({
|
||||
participant,
|
||||
shouldUseFullName = false,
|
||||
}: {
|
||||
participant: EmailThreadMessageParticipant;
|
||||
shouldUseFullName?: boolean;
|
||||
}) => {
|
||||
if (participant.person) {
|
||||
return (
|
||||
`${participant.person?.name?.firstName}` +
|
||||
(shouldUseFullName ? ` ${participant.person?.name?.lastName}` : '')
|
||||
);
|
||||
}
|
||||
|
||||
if (participant.workspaceMember) {
|
||||
return (
|
||||
participant.workspaceMember?.name?.firstName +
|
||||
(shouldUseFullName
|
||||
? ` ${participant.workspaceMember?.name?.lastName}`
|
||||
: '')
|
||||
);
|
||||
}
|
||||
|
||||
if (participant.displayName) {
|
||||
return participant.displayName;
|
||||
}
|
||||
|
||||
if (participant.handle) {
|
||||
return participant.handle;
|
||||
}
|
||||
|
||||
return 'Unknown';
|
||||
};
|
||||
Reference in New Issue
Block a user