@@ -5,11 +5,12 @@ import { TranslateService } from '@ngx-translate/core';
55import {
66 BehaviorSubject ,
77 combineLatest as observableCombineLatest ,
8+ EMPTY ,
89 Observable ,
910 of as observableOf ,
1011 Subscription
1112} from 'rxjs' ;
12- import { catchError , map , switchMap , tap } from 'rxjs/operators' ;
13+ import { catchError , defaultIfEmpty , map , switchMap , tap } from 'rxjs/operators' ;
1314import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service' ;
1415import { AuthorizationDataService } from '../../core/data/feature-authorization/authorization-data.service' ;
1516import { FeatureID } from '../../core/data/feature-authorization/feature-id' ;
@@ -144,7 +145,7 @@ export class GroupsRegistryComponent implements OnInit, OnDestroy {
144145 }
145146 return this . authorizationService . isAuthorized ( FeatureID . AdministratorOf ) . pipe (
146147 switchMap ( ( isSiteAdmin : boolean ) => {
147- return observableCombineLatest ( groups . page . map ( ( group : Group ) => {
148+ return observableCombineLatest ( [ ... groups . page . map ( ( group : Group ) => {
148149 if ( hasValue ( group ) && ! this . deletedGroupsIds . includes ( group . id ) ) {
149150 return observableCombineLatest ( [
150151 this . authorizationService . isAuthorized ( FeatureID . CanDelete , group . self ) ,
@@ -165,8 +166,10 @@ export class GroupsRegistryComponent implements OnInit, OnDestroy {
165166 }
166167 )
167168 ) ;
169+ } else {
170+ return EMPTY ;
168171 }
169- } ) ) . pipe ( map ( ( dtos : GroupDtoModel [ ] ) => {
172+ } ) ] ) . pipe ( defaultIfEmpty ( [ ] ) , map ( ( dtos : GroupDtoModel [ ] ) => {
170173 return buildPaginatedList ( groups . pageInfo , dtos ) ;
171174 } ) ) ;
172175 } )
0 commit comments