@@ -210,6 +210,27 @@ export class MgtPeople extends MgtTemplatedComponent {
210210 } )
211211 public scopes : string [ ] = [ ] ;
212212
213+ /**
214+ * Fallback when no user is found
215+ * @type {IDynamicPerson[] }
216+ */
217+ @property ( {
218+ attribute : 'fallback-details' ,
219+ type : Array
220+ } )
221+ public get fallbackDetails ( ) : IDynamicPerson [ ] {
222+ return this . _fallbackDetails ;
223+ }
224+ public set fallbackDetails ( value : IDynamicPerson [ ] ) {
225+ if ( value === this . _fallbackDetails ) {
226+ return ;
227+ }
228+
229+ this . _fallbackDetails = value ;
230+
231+ this . requestStateUpdate ( ) ;
232+ }
233+
213234 /**
214235 * Get the scopes required for people
215236 *
@@ -236,6 +257,7 @@ export class MgtPeople extends MgtTemplatedComponent {
236257 private _peoplePresence : { } ;
237258 private _resource : string ;
238259 private _version : string = 'v1.0' ;
260+ private _fallbackDetails : IDynamicPerson [ ] ;
239261
240262 constructor ( ) {
241263 super ( ) ;
@@ -304,7 +326,6 @@ export class MgtPeople extends MgtTemplatedComponent {
304326 */
305327 protected renderPeople ( ) : TemplateResult {
306328 const maxPeople = this . people . slice ( 0 , this . showMax ) ;
307-
308329 return html `
309330 < ul class ="people-list ">
310331 ${ repeat (
@@ -405,10 +426,21 @@ export class MgtPeople extends MgtTemplatedComponent {
405426 // populate people
406427 if ( this . groupId ) {
407428 this . people = await findGroupMembers ( graph , null , this . groupId , this . showMax , PersonType . person ) ;
408- } else if ( this . userIds ) {
409- this . people = await getUsersForUserIds ( graph , this . userIds ) ;
410- } else if ( this . peopleQueries ) {
411- this . people = await getUsersForPeopleQueries ( graph , this . peopleQueries ) ;
429+ } else if ( this . userIds || this . peopleQueries ) {
430+ this . userIds
431+ ? ( this . people = await getUsersForUserIds ( graph , this . userIds ) )
432+ : ( this . people = await getUsersForPeopleQueries ( graph , this . peopleQueries ) ) ;
433+ if ( this . _fallbackDetails ) {
434+ // replace null people with fallback details
435+ this . people = this . people . map ( ( p , i ) => {
436+ if ( p ) {
437+ return p ;
438+ } else if ( i < this . _fallbackDetails . length ) {
439+ return this . _fallbackDetails [ i ] ;
440+ }
441+ return null ;
442+ } ) ;
443+ }
412444 } else if ( this . resource ) {
413445 this . people = await getPeopleFromResource ( graph , this . version , this . resource , this . scopes ) ;
414446 } else {
0 commit comments