getUserDisplayName.ts 384 B

12345678910111213
  1. // Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. import { isEmpty } from 'lodash-es'
  3. import type { User } from '@shared/graphql/types'
  4. export const userDisplayName = (user: Partial<User>): string => {
  5. const { fullname, email, phone, login } = user
  6. return (
  7. [fullname, email, phone, login].find((elem) => elem && !isEmpty(elem)) ||
  8. '-'
  9. )
  10. }