Skip to content

Commit 50cb219

Browse files
committed
fix issue where the group overview page would throw an error after deleting a group
1 parent 379d78e commit 50cb219

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/app/access-control/group-registry/groups-registry.component.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ import { TranslateService } from '@ngx-translate/core';
55
import {
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';
1314
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
1415
import { AuthorizationDataService } from '../../core/data/feature-authorization/authorization-data.service';
1516
import { 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

Comments
 (0)