File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -229,10 +229,11 @@ export default class SPPeopleSearchService {
229229 switch ( element . EntityType ) {
230230 case 'User' :
231231 let email : string = element . EntityData . Email !== null ? element . EntityData . Email : element . Description ;
232+ const accountName = this . getAccountName ( element ) ;
232233 return {
233234 id : element . Key ,
234235 loginName : element . LoginName ? element . LoginName : element . Key ,
235- imageUrl : this . generateUserPhotoLink ( email ) ,
236+ imageUrl : this . generateUserPhotoLink ( accountName ) ,
236237 imageInitials : this . getFullNameInitials ( element . DisplayText ) ,
237238 text : element . DisplayText , // name
238239 secondaryText : email , // email
@@ -309,6 +310,20 @@ export default class SPPeopleSearchService {
309310 return null ;
310311 }
311312
313+ /**
314+ * Gets account name for user, falls back to description
315+ */
316+ private getAccountName ( element : any ) : string {
317+ const loginName : string = element . LoginName || element . Key ;
318+ if ( loginName ) {
319+ const loginParts : string [ ] = loginName . split ( "|" ) ;
320+ if ( loginParts . length > 0 ) {
321+ return loginParts [ loginParts . length - 1 ] ;
322+ }
323+ }
324+ return element . Description || "" ;
325+ }
326+
312327 /**
313328 * Generates Initials from a full name
314329 */
You can’t perform that action at this time.
0 commit comments