File tree 2 files changed +20
-4
lines changed
client/src/client-only-routes 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -423,7 +423,7 @@ function createShowCert(app) {
423
423
]
424
424
} ) ;
425
425
}
426
- const { isLocked, showCerts } = user . profileUI ;
426
+ const { isLocked, showCerts, showName } = user . profileUI ;
427
427
428
428
if ( ! user . name ) {
429
429
return res . json ( {
@@ -512,6 +512,16 @@ function createShowCert(app) {
512
512
}
513
513
514
514
const { username, name } = user ;
515
+
516
+ if ( ! showName ) {
517
+ return res . json ( {
518
+ certTitle,
519
+ username,
520
+ date : completedDate ,
521
+ completionTime
522
+ } ) ;
523
+ }
524
+
515
525
return res . json ( {
516
526
certTitle,
517
527
username,
Original file line number Diff line number Diff line change @@ -75,6 +75,9 @@ const propTypes = {
75
75
)
76
76
} )
77
77
) ,
78
+ profileUI : PropTypes . shape ( {
79
+ showName : PropTypes . bool
80
+ } ) ,
78
81
username : PropTypes . string
79
82
} ) ,
80
83
userFetchState : PropTypes . shape ( {
@@ -230,13 +233,16 @@ const ShowCertification = props => {
230
233
231
234
const {
232
235
date,
233
- name : userFullName ,
236
+ name : userFullName = null ,
234
237
username,
235
238
certTitle,
236
239
completionTime
237
240
} = cert ;
241
+
238
242
const { user } = props ;
239
243
244
+ const displayName = userFullName ?? username ;
245
+
240
246
const certDate = new Date ( date ) ;
241
247
const certYear = certDate . getFullYear ( ) ;
242
248
const certMonth = certDate . getMonth ( ) ;
@@ -328,7 +334,7 @@ const ShowCertification = props => {
328
334
< div className = 'information-container' >
329
335
< h3 > This certifies that</ h3 >
330
336
< h1 >
331
- < strong > { userFullName } </ strong >
337
+ < strong > { displayName } </ strong >
332
338
</ h1 >
333
339
< h3 > has successfully completed the freeCodeCamp.org</ h3 >
334
340
< h1 >
@@ -362,7 +368,7 @@ const ShowCertification = props => {
362
368
</ Grid >
363
369
{ signedInUserName === username ? shareCertBtns : '' }
364
370
< Spacer size = { 2 } />
365
- < ShowProjectLinks user = { user } name = { userFullName } certName = { certTitle } />
371
+ < ShowProjectLinks user = { user } name = { displayName } certName = { certTitle } />
366
372
</ div >
367
373
) ;
368
374
} ;
You can’t perform that action at this time.
0 commit comments