getUserDisplayName.ts 388 B

1234567891011121314
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import { isEmpty } from 'lodash-es'
  3. import type { User } from '#shared/graphql/types.ts'
  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. }