Skip to content

Commit

Permalink
Merge pull request #855 from atmire/Curation-task-email-parameter-rem…
Browse files Browse the repository at this point in the history
…oval

Removal of email option for the curation script
  • Loading branch information
tdonohue committed Sep 2, 2020
2 parents f494600 + be79663 commit 16a68da
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 24 deletions.
12 changes: 0 additions & 12 deletions src/app/curation-form/curation-form.component.spec.ts
Expand Up @@ -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';
Expand All @@ -27,7 +25,6 @@ describe('CurationFormComponent', () => {
let scriptDataService: ScriptDataService;
let processDataService: ProcessDataService;
let configurationDataService: ConfigurationDataService;
let authService: AuthService;
let notificationsService;
let router;

Expand All @@ -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',
Expand All @@ -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},
Expand Down Expand Up @@ -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');
Expand All @@ -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();
Expand All @@ -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', () => {
Expand All @@ -159,7 +148,6 @@ describe('CurationFormComponent', () => {
expect(scriptDataService.invoke).toHaveBeenCalledWith('curate', [
{name: '-t', value: 'profileformats'},
{name: '-i', value: 'all'},
{name: '-e', value: 'test@mail'},
], []);
});
});
15 changes: 3 additions & 12 deletions src/app/curation-form/curation-form.component.ts
Expand Up @@ -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';
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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'));
Expand Down

0 comments on commit 16a68da

Please sign in to comment.