From b1aa2f3550b5ab2aa01736a99d3eb307f5e7b004 Mon Sep 17 00:00:00 2001 From: Alisa Ismailati Date: Tue, 6 Jun 2023 16:57:17 +0200 Subject: [PATCH] [DURACOM-151] reverted setStaleByUUID method as it was --- .../eperson-form/eperson-form.component.ts | 1 - src/app/core/data/request.service.spec.ts | 7 +++++-- src/app/core/data/request.service.ts | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts b/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts index 1fd0e05ccb..d009d56058 100644 --- a/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts +++ b/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts @@ -495,7 +495,6 @@ export class EPersonFormComponent implements OnInit, OnDestroy { ).subscribe(({ restResponse, eperson }: { restResponse: RemoteData | null, eperson: EPerson }) => { if (restResponse?.hasSucceeded) { this.notificationsService.success(this.translateService.get(this.labelPrefix + 'notification.deleted.success', { name: this.dsoNameService.getName(eperson) })); - this.submitForm.emit(); } else { this.notificationsService.error(`Error occurred when trying to delete EPerson with id: ${eperson?.id} with code: ${restResponse?.statusCode} and message: ${restResponse?.errorMessage}`); } diff --git a/src/app/core/data/request.service.spec.ts b/src/app/core/data/request.service.spec.ts index 8509f60eb7..108a588881 100644 --- a/src/app/core/data/request.service.spec.ts +++ b/src/app/core/data/request.service.spec.ts @@ -627,8 +627,11 @@ describe('RequestService', () => { it('should return an Observable that emits true as soon as the request is stale', fakeAsync(() => { dispatchSpy.and.callFake(() => { /* empty */ }); // don't actually set as stale - getByUUIDSpy.and.returnValue(cold('-----(a|)', { // but fake the state in the cache - a: { state: RequestEntryState.SuccessStale }, + getByUUIDSpy.and.returnValue(cold('a-b--c--d-', { // but fake the state in the cache + a: { state: RequestEntryState.ResponsePending }, + b: { state: RequestEntryState.Success }, + c: { state: RequestEntryState.SuccessStale }, + d: { state: RequestEntryState.Error }, })); const done$ = service.setStaleByUUID('something'); diff --git a/src/app/core/data/request.service.ts b/src/app/core/data/request.service.ts index 78f53ffe3a..1f6680203e 100644 --- a/src/app/core/data/request.service.ts +++ b/src/app/core/data/request.service.ts @@ -328,9 +328,9 @@ export class RequestService { this.store.dispatch(new RequestStaleAction(uuid)); return this.getByUUID(uuid).pipe( - take(1), map((request: RequestEntry) => isStale(request.state)), filter((stale: boolean) => stale), + take(1), ); }