Skip to content

Commit e24f0e3

Browse files
authored
Merge pull request DSpace#1873 from atmire/Fix-EPerson-delete-infinite-loop
Fix infinite loop when deleting an EPerson
2 parents bf08244 + 50cb219 commit e24f0e3

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/app/access-control/epeople-registry/epeople-registry.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,6 @@ export class EPeopleRegistryComponent implements OnInit, OnDestroy {
238238
this.epersonService.deleteEPerson(ePerson).pipe(getFirstCompletedRemoteData()).subscribe((restResponse: RemoteData<NoContent>) => {
239239
if (restResponse.hasSucceeded) {
240240
this.notificationsService.success(this.translateService.get(this.labelPrefix + 'notification.deleted.success', {name: ePerson.name}));
241-
this.reset();
242241
} else {
243242
this.notificationsService.error('Error occured when trying to delete EPerson with id: ' + ePerson.id + ' with code: ' + restResponse.statusCode + ' and message: ' + restResponse.errorMessage);
244243
}

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)