From be79663df99f85a15ca4988f435d677394f79132 Mon Sep 17 00:00:00 2001 From: jonas-atmire Date: Wed, 2 Sep 2020 14:59:44 +0200 Subject: [PATCH] Removal of email option for the curation script -> See https://github.com/DSpace/DSpace/pull/2926#pullrequestreview-477868288 for full explanation --- .../curation-form/curation-form.component.spec.ts | 12 ------------ src/app/curation-form/curation-form.component.ts | 15 +++------------ 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/src/app/curation-form/curation-form.component.spec.ts b/src/app/curation-form/curation-form.component.spec.ts index 93bad4fef2b..0c78bf948c1 100644 --- a/src/app/curation-form/curation-form.component.spec.ts +++ b/src/app/curation-form/curation-form.component.spec.ts @@ -4,13 +4,11 @@ import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { CurationFormComponent } from './curation-form.component'; import { ScriptDataService } from '../core/data/processes/script-data.service'; import { ProcessDataService } from '../core/data/processes/process-data.service'; -import { AuthService } from '../core/auth/auth.service'; import { of as observableOf } from 'rxjs'; import { RequestEntry } from '../core/data/request.reducer'; import { DSOSuccessResponse, RestResponse } from '../core/cache/response.models'; import { Process } from '../process-page/processes/process.model'; import { createSuccessfulRemoteDataObject$ } from '../shared/remote-data.utils'; -import { EPerson } from '../core/eperson/models/eperson.model'; import { NotificationsServiceStub } from '../shared/testing/notifications-service.stub'; import { RouterStub } from '../shared/testing/router.stub'; import { NotificationsService } from '../shared/notifications/notifications.service'; @@ -27,7 +25,6 @@ describe('CurationFormComponent', () => { let scriptDataService: ScriptDataService; let processDataService: ProcessDataService; let configurationDataService: ConfigurationDataService; - let authService: AuthService; let notificationsService; let router; @@ -48,10 +45,6 @@ describe('CurationFormComponent', () => { findByHref: createSuccessfulRemoteDataObject$(process) }); - authService = jasmine.createSpyObj('authService', { - getAuthenticatedUserFromStore: observableOf(Object.assign(new EPerson(), {email: 'test@mail'})) - }); - configurationDataService = jasmine.createSpyObj('configurationDataService', { findByPropertyName: createSuccessfulRemoteDataObject$(Object.assign(new ConfigurationProperty(), { name: 'plugin.named.org.dspace.curate.CurationTask', @@ -74,7 +67,6 @@ describe('CurationFormComponent', () => { providers: [ {provide: ScriptDataService, useValue: scriptDataService}, {provide: ProcessDataService, useValue: processDataService}, - {provide: AuthService, useValue: authService}, {provide: NotificationsService, useValue: notificationsService}, {provide: Router, useValue: router}, {provide: ConfigurationDataService, useValue: configurationDataService}, @@ -119,7 +111,6 @@ describe('CurationFormComponent', () => { expect(scriptDataService.invoke).toHaveBeenCalledWith('curate', [ {name: '-t', value: 'profileformats'}, {name: '-i', value: 'test-handle'}, - {name: '-e', value: 'test@mail'}, ], []); expect(notificationsService.success).toHaveBeenCalled(); expect(processDataService.findByHref).toHaveBeenCalledWith('process-link'); @@ -134,7 +125,6 @@ describe('CurationFormComponent', () => { expect(scriptDataService.invoke).toHaveBeenCalledWith('curate', [ {name: '-t', value: 'profileformats'}, {name: '-i', value: 'test-handle'}, - {name: '-e', value: 'test@mail'}, ], []); expect(notificationsService.error).toHaveBeenCalled(); expect(processDataService.findByHref).not.toHaveBeenCalled(); @@ -149,7 +139,6 @@ describe('CurationFormComponent', () => { expect(scriptDataService.invoke).toHaveBeenCalledWith('curate', [ {name: '-t', value: 'profileformats'}, {name: '-i', value: 'form-handle'}, - {name: '-e', value: 'test@mail'}, ], []); }); it('should use "all" when the handle provided by the form is empty and when no dsoHandle is provided', () => { @@ -159,7 +148,6 @@ describe('CurationFormComponent', () => { expect(scriptDataService.invoke).toHaveBeenCalledWith('curate', [ {name: '-t', value: 'profileformats'}, {name: '-i', value: 'all'}, - {name: '-e', value: 'test@mail'}, ], []); }); }); diff --git a/src/app/curation-form/curation-form.component.ts b/src/app/curation-form/curation-form.component.ts index 95512d11299..36382b0797f 100644 --- a/src/app/curation-form/curation-form.component.ts +++ b/src/app/curation-form/curation-form.component.ts @@ -3,9 +3,7 @@ import { ScriptDataService } from '../core/data/processes/script-data.service'; import { FormControl, FormGroup } from '@angular/forms'; import { getResponseFromEntry } from '../core/shared/operators'; import { DSOSuccessResponse } from '../core/cache/response.models'; -import { AuthService } from '../core/auth/auth.service'; -import { filter, map, switchMap, take } from 'rxjs/operators'; -import { EPerson } from '../core/eperson/models/eperson.model'; +import { filter, map, take } from 'rxjs/operators'; import { NotificationsService } from '../shared/notifications/notifications.service'; import { TranslateService } from '@ngx-translate/core'; import { hasValue, isEmpty, isNotEmpty } from '../shared/empty.util'; @@ -40,7 +38,6 @@ export class CurationFormComponent implements OnInit { private scriptDataService: ScriptDataService, private configurationDataService: ConfigurationDataService, private processDataService: ProcessDataService, - private authService: AuthService, private notificationsService: NotificationsService, private translateService: TranslateService, private router: Router @@ -90,16 +87,10 @@ export class CurationFormComponent implements OnInit { handle = 'all'; } } - this.authService.getAuthenticatedUserFromStore().pipe( - take(1), - switchMap((eperson: EPerson) => { - return this.scriptDataService.invoke('curate', [ + this.scriptDataService.invoke('curate', [ {name: '-t', value: taskName}, {name: '-i', value: handle}, - {name: '-e', value: eperson.email}, - ], []).pipe(getResponseFromEntry()); - }) - ).subscribe((response: DSOSuccessResponse) => { + ], []).pipe(getResponseFromEntry()).subscribe((response: DSOSuccessResponse) => { if (response.isSuccessful) { this.notificationsService.success(this.translateService.get('curation.form.submit.success.head'), this.translateService.get('curation.form.submit.success.content'));