forked from hazza/dspace-angular
fix issue where deleting a member from a group would cause an infinite re-request loop
This commit is contained in:
@@ -209,7 +209,6 @@ export class MembersListComponent implements OnInit, OnDestroy {
|
|||||||
if (activeGroup != null) {
|
if (activeGroup != null) {
|
||||||
const response = this.groupDataService.deleteMemberFromGroup(activeGroup, ePerson.eperson);
|
const response = this.groupDataService.deleteMemberFromGroup(activeGroup, ePerson.eperson);
|
||||||
this.showNotifications('deleteMember', response, ePerson.eperson.name, activeGroup);
|
this.showNotifications('deleteMember', response, ePerson.eperson.name, activeGroup);
|
||||||
this.search({ scope: this.currentSearchScope, query: this.currentSearchQuery });
|
|
||||||
} else {
|
} else {
|
||||||
this.notificationsService.error(this.translateService.get(this.messagePrefix + '.notification.failure.noActiveGroup'));
|
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<any>) => {
|
response.pipe(getFirstCompletedRemoteData()).subscribe((rd: RemoteData<any>) => {
|
||||||
if (rd.hasSucceeded) {
|
if (rd.hasSucceeded) {
|
||||||
this.notificationsService.success(this.translateService.get(this.messagePrefix + '.notification.success.' + messageSuffix, { name: nameObject }));
|
this.notificationsService.success(this.translateService.get(this.messagePrefix + '.notification.success.' + messageSuffix, { name: nameObject }));
|
||||||
this.ePersonDataService.clearLinkRequests(activeGroup._links.epersons.href);
|
|
||||||
} else {
|
} else {
|
||||||
this.notificationsService.error(this.translateService.get(this.messagePrefix + '.notification.failure.' + messageSuffix, { name: nameObject }));
|
this.notificationsService.error(this.translateService.get(this.messagePrefix + '.notification.failure.' + messageSuffix, { name: nameObject }));
|
||||||
}
|
}
|
||||||
|
@@ -191,9 +191,7 @@ describe('GroupDataService', () => {
|
|||||||
callback();
|
callback();
|
||||||
|
|
||||||
expect(objectCache.getByHref).toHaveBeenCalledWith(EPersonMock2._links.self.href);
|
expect(objectCache.getByHref).toHaveBeenCalledWith(EPersonMock2._links.self.href);
|
||||||
expect(objectCache.getByHref).toHaveBeenCalledWith(GroupMock._links.self.href);
|
expect(requestService.setStaleByUUID).toHaveBeenCalledTimes(2);
|
||||||
expect(requestService.setStaleByUUID).toHaveBeenCalledTimes(4);
|
|
||||||
expect(requestService.setStaleByUUID).toHaveBeenCalledWith('request1');
|
|
||||||
expect(requestService.setStaleByUUID).toHaveBeenCalledWith('request2');
|
expect(requestService.setStaleByUUID).toHaveBeenCalledWith('request2');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -218,9 +216,7 @@ describe('GroupDataService', () => {
|
|||||||
callback();
|
callback();
|
||||||
|
|
||||||
expect(objectCache.getByHref).toHaveBeenCalledWith(EPersonMock._links.self.href);
|
expect(objectCache.getByHref).toHaveBeenCalledWith(EPersonMock._links.self.href);
|
||||||
expect(objectCache.getByHref).toHaveBeenCalledWith(GroupMock._links.self.href);
|
expect(requestService.setStaleByUUID).toHaveBeenCalledTimes(2);
|
||||||
expect(requestService.setStaleByUUID).toHaveBeenCalledTimes(4);
|
|
||||||
expect(requestService.setStaleByUUID).toHaveBeenCalledWith('request1');
|
|
||||||
expect(requestService.setStaleByUUID).toHaveBeenCalledWith('request2');
|
expect(requestService.setStaleByUUID).toHaveBeenCalledWith('request2');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -179,7 +179,6 @@ export class GroupDataService extends IdentifiableDataService<Group> implements
|
|||||||
|
|
||||||
return this.rdbService.buildFromRequestUUIDAndAwait(requestId, () => observableZip(
|
return this.rdbService.buildFromRequestUUIDAndAwait(requestId, () => observableZip(
|
||||||
this.invalidateByHref(ePerson._links.self.href),
|
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(ePerson._links.groups.href).pipe(take(1)),
|
||||||
this.requestService.setStaleByHrefSubstring(activeGroup._links.epersons.href).pipe(take(1)),
|
this.requestService.setStaleByHrefSubstring(activeGroup._links.epersons.href).pipe(take(1)),
|
||||||
));
|
));
|
||||||
@@ -198,7 +197,6 @@ export class GroupDataService extends IdentifiableDataService<Group> implements
|
|||||||
|
|
||||||
return this.rdbService.buildFromRequestUUIDAndAwait(requestId, () => observableZip(
|
return this.rdbService.buildFromRequestUUIDAndAwait(requestId, () => observableZip(
|
||||||
this.invalidateByHref(ePerson._links.self.href),
|
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(ePerson._links.groups.href).pipe(take(1)),
|
||||||
this.requestService.setStaleByHrefSubstring(activeGroup._links.epersons.href).pipe(take(1)),
|
this.requestService.setStaleByHrefSubstring(activeGroup._links.epersons.href).pipe(take(1)),
|
||||||
));
|
));
|
||||||
|
Reference in New Issue
Block a user