diff --git a/api-server/server/boot/certificate.js b/api-server/server/boot/certificate.js index e268168cdc..67f680a5ed 100644 --- a/api-server/server/boot/certificate.js +++ b/api-server/server/boot/certificate.js @@ -423,7 +423,7 @@ function createShowCert(app) { ] }); } - const { isLocked, showCerts } = user.profileUI; + const { isLocked, showCerts, showName } = user.profileUI; if (!user.name) { return res.json({ @@ -512,6 +512,16 @@ function createShowCert(app) { } const { username, name } = user; + + if (!showName) { + return res.json({ + certTitle, + username, + date: completedDate, + completionTime + }); + } + return res.json({ certTitle, username, diff --git a/client/src/client-only-routes/ShowCertification.js b/client/src/client-only-routes/ShowCertification.js index 505c713319..c95d5004e4 100644 --- a/client/src/client-only-routes/ShowCertification.js +++ b/client/src/client-only-routes/ShowCertification.js @@ -75,6 +75,9 @@ const propTypes = { ) }) ), + profileUI: PropTypes.shape({ + showName: PropTypes.bool + }), username: PropTypes.string }), userFetchState: PropTypes.shape({ @@ -230,13 +233,16 @@ const ShowCertification = props => { const { date, - name: userFullName, + name: userFullName = null, username, certTitle, completionTime } = cert; + const { user } = props; + const displayName = userFullName ?? username; + const certDate = new Date(date); const certYear = certDate.getFullYear(); const certMonth = certDate.getMonth(); @@ -328,7 +334,7 @@ const ShowCertification = props => {