fix: return handle if no jCard

This commit is contained in:
Maël Gangloff
2024-08-21 16:32:23 +02:00
parent 997d247a39
commit 2ac1ae1a4c
2 changed files with 5 additions and 3 deletions

View File

@@ -69,6 +69,8 @@ export const actionToIcon = (a: EventAction) => a === 'registration' ?
export const entityToName = (e: { entity: Entity }): string => {
if (e.entity.jCard.length === 0) return e.entity.handle
const jCard = vCard.fromJSON(e.entity.jCard)
let name = e.entity.handle
if (jCard.data.fn && !Array.isArray(jCard.data.fn) && jCard.data.fn.valueOf() !== '') name = jCard.data.fn.valueOf()