From cf8fb41717c48012b24efb46a36588c567ddc673 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20FAMIBELLE-PRONZOLA?= Date: Sun, 22 May 2022 14:18:30 +0400 Subject: [PATCH] Fix username display --- components/teks/pataje.js | 2 +- components/teks/teks.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/teks/pataje.js b/components/teks/pataje.js index 0261197..2c796a8 100644 --- a/components/teks/pataje.js +++ b/components/teks/pataje.js @@ -51,7 +51,7 @@ export default function Pataje({parole, setError, setSuccess}) { const alias = artistes.data.map(({attributes}) => attributes.alias) const renderAwtis = new Intl.ListFormat('fr').format(alias) - const text = parole.user || parole.userAdmin ? `${renderAwtis} - ${titre} (Paroles et Traductions) - (texte soumis par ${parole?.user?.data?.attributes?.username || parole.userAdmin?.data?.attributes?.username})` : `${renderAwtis} - ${parole} (Paroles et Traductions)` + const text = parole.user || parole.userAdmin ? `${renderAwtis} - ${titre} (Paroles et Traductions) - (texte soumis par ${parole?.user?.data?.attributes?.username || parole.userAdmin?.data?.attributes?.username || parole.userAdmin?.data?.attributes?.firstname})` : `${renderAwtis} - ${parole} (Paroles et Traductions)` const handleClose = () => { setOpen(false) diff --git a/components/teks/teks.js b/components/teks/teks.js index 90d4aa4..60af9e1 100644 --- a/components/teks/teks.js +++ b/components/teks/teks.js @@ -161,9 +161,9 @@ export default function Teks({parole, paroleId, commentaires, open, success, err texte soumis par {parole.user.data.attributes.username} )} - {parole.userAdmin && !parole.user && ( + {parole?.userAdmin?.data && !parole.user.data && ( - texte soumis par {parole.userAdmin} + texte soumis par {parole.userAdmin.data.attributes.username || parole.userAdmin.data.attributes.firstname} )}