(userId: string, mentions?: SerializedUser[])
| 1 | import { SerializedUser } from '@linen/types'; |
| 2 | |
| 3 | export function getDisplayName(userId: string, mentions?: SerializedUser[]) { |
| 4 | if (!mentions) { |
| 5 | return 'User'; |
| 6 | } |
| 7 | return userId === 'channel' |
| 8 | ? userId |
| 9 | : mentions.find( |
| 10 | (user) => user.id === userId || user.externalUserId === userId |
| 11 | )?.displayName || 'User'; |
| 12 | } |