From c55c15b6f60a84a3758f58fed538eaaf8ce1d5f7 Mon Sep 17 00:00:00 2001 From: Art Lowel Date: Wed, 5 Oct 2022 18:27:09 +0200 Subject: [PATCH] fix issue where deleting a member from a group would cause an infinite re-request loop --- .../group-form/members-list/members-list.component.ts | 2 -- src/app/core/eperson/group-data.service.spec.ts | 8 ++------ src/app/core/eperson/group-data.service.ts | 2 -- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/app/access-control/group-registry/group-form/members-list/members-list.component.ts b/src/app/access-control/group-registry/group-form/members-list/members-list.component.ts index 5c02e02d78..169d009d63 100644 --- a/src/app/access-control/group-registry/group-form/members-list/members-list.component.ts +++ b/src/app/access-control/group-registry/group-form/members-list/members-list.component.ts @@ -209,7 +209,6 @@ export class MembersListComponent implements OnInit, OnDestroy { if (activeGroup != null) { const response = this.groupDataService.deleteMemberFromGroup(activeGroup, ePerson.eperson); this.showNotifications('deleteMember', response, ePerson.eperson.name, activeGroup); - this.search({ scope: this.currentSearchScope, query: this.currentSearchQuery }); } else { this.notificationsService.error(this.translateService.get(this.messagePrefix + '.notification.failure.noActiveGroup')); } @@ -315,7 +314,6 @@ export class MembersListComponent implements OnInit, OnDestroy { response.pipe(getFirstCompletedRemoteData()).subscribe((rd: RemoteData) => { if (rd.hasSucceeded) { this.notificationsService.success(this.translateService.get(this.messagePrefix + '.notification.success.' + messageSuffix, { name: nameObject })); - this.ePersonDataService.clearLinkRequests(activeGroup._links.epersons.href); } else { this.notificationsService.error(this.translateService.get(this.messagePrefix + '.notification.failure.' + messageSuffix, { name: nameObject })); } diff --git a/src/app/core/eperson/group-data.service.spec.ts b/src/app/core/eperson/group-data.service.spec.ts index 6fdc302cff..b424aed1aa 100644 --- a/src/app/core/eperson/group-data.service.spec.ts +++ b/src/app/core/eperson/group-data.service.spec.ts @@ -191,9 +191,7 @@ describe('GroupDataService', () => { callback(); expect(objectCache.getByHref).toHaveBeenCalledWith(EPersonMock2._links.self.href); - expect(objectCache.getByHref).toHaveBeenCalledWith(GroupMock._links.self.href); - expect(requestService.setStaleByUUID).toHaveBeenCalledTimes(4); - expect(requestService.setStaleByUUID).toHaveBeenCalledWith('request1'); + expect(requestService.setStaleByUUID).toHaveBeenCalledTimes(2); expect(requestService.setStaleByUUID).toHaveBeenCalledWith('request2'); }); }); @@ -218,9 +216,7 @@ describe('GroupDataService', () => { callback(); expect(objectCache.getByHref).toHaveBeenCalledWith(EPersonMock._links.self.href); - expect(objectCache.getByHref).toHaveBeenCalledWith(GroupMock._links.self.href); - expect(requestService.setStaleByUUID).toHaveBeenCalledTimes(4); - expect(requestService.setStaleByUUID).toHaveBeenCalledWith('request1'); + expect(requestService.setStaleByUUID).toHaveBeenCalledTimes(2); expect(requestService.setStaleByUUID).toHaveBeenCalledWith('request2'); }); }); diff --git a/src/app/core/eperson/group-data.service.ts b/src/app/core/eperson/group-data.service.ts index 77a4add159..bb38e46758 100644 --- a/src/app/core/eperson/group-data.service.ts +++ b/src/app/core/eperson/group-data.service.ts @@ -179,7 +179,6 @@ export class GroupDataService extends IdentifiableDataService implements return this.rdbService.buildFromRequestUUIDAndAwait(requestId, () => observableZip( this.invalidateByHref(ePerson._links.self.href), - this.invalidateByHref(activeGroup._links.self.href), this.requestService.setStaleByHrefSubstring(ePerson._links.groups.href).pipe(take(1)), this.requestService.setStaleByHrefSubstring(activeGroup._links.epersons.href).pipe(take(1)), )); @@ -198,7 +197,6 @@ export class GroupDataService extends IdentifiableDataService implements return this.rdbService.buildFromRequestUUIDAndAwait(requestId, () => observableZip( this.invalidateByHref(ePerson._links.self.href), - this.invalidateByHref(activeGroup._links.self.href), this.requestService.setStaleByHrefSubstring(ePerson._links.groups.href).pipe(take(1)), this.requestService.setStaleByHrefSubstring(activeGroup._links.epersons.href).pipe(take(1)), ));