Skip to content

Commit 1a6ff3c

Browse files
author
Juha Alhojoki
committed
people picker imageUrl was resolved by user email, when it should be resolved by user's accountName
1 parent a3714ee commit 1a6ff3c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/services/PeopleSearchService.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ 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);
232+
// Description contains the account name for a user
233+
const accountName = element.Description || this.getAccountName(element);
233234
return {
234235
id: element.Key,
235236
loginName: element.LoginName ? element.LoginName : element.Key,
@@ -311,7 +312,7 @@ export default class SPPeopleSearchService {
311312
}
312313

313314
/**
314-
* Gets account name for user, falls back to description
315+
* Gets account name for user
315316
*/
316317
private getAccountName(element: any): string {
317318
if (!element) { return ""; }
@@ -320,7 +321,8 @@ export default class SPPeopleSearchService {
320321
const loginParts: string[] = loginName.split("|");
321322
return loginParts[loginParts.length - 1];
322323
}
323-
return element.Description || "";
324+
325+
return "";
324326
}
325327

326328
/**

0 commit comments

Comments
 (0)