mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
[DSC-130] Fix issue when switching submission's collection between those with different submission definition
This commit is contained in:
@@ -261,9 +261,10 @@ describe('SubmissionFormCollectionComponent Component', () => {
|
|||||||
expect(comp.toggled).toHaveBeenCalled();
|
expect(comp.toggled).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should ', () => {
|
it('should change collection properly', () => {
|
||||||
spyOn(comp.collectionChange, 'emit').and.callThrough();
|
spyOn(comp.collectionChange, 'emit').and.callThrough();
|
||||||
jsonPatchOpServiceStub.jsonPatchByResourceID.and.returnValue(of(submissionRestResponse));
|
jsonPatchOpServiceStub.jsonPatchByResourceID.and.returnValue(of(submissionRestResponse));
|
||||||
|
submissionServiceStub.retrieveSubmission.and.returnValue(createSuccessfulRemoteDataObject$(submissionRestResponse[0]));
|
||||||
comp.ngOnInit();
|
comp.ngOnInit();
|
||||||
comp.onSelect(mockCollectionList[1]);
|
comp.onSelect(mockCollectionList[1]);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
@@ -13,7 +13,7 @@ import {
|
|||||||
import { BehaviorSubject, Observable, of as observableOf, Subscription } from 'rxjs';
|
import { BehaviorSubject, Observable, of as observableOf, Subscription } from 'rxjs';
|
||||||
import {
|
import {
|
||||||
find,
|
find,
|
||||||
map
|
map, mergeMap
|
||||||
} from 'rxjs/operators';
|
} from 'rxjs/operators';
|
||||||
|
|
||||||
import { Collection } from '../../../core/shared/collection.model';
|
import { Collection } from '../../../core/shared/collection.model';
|
||||||
@@ -27,6 +27,7 @@ import { SubmissionJsonPatchOperationsService } from '../../../core/submission/s
|
|||||||
import { CollectionDataService } from '../../../core/data/collection-data.service';
|
import { CollectionDataService } from '../../../core/data/collection-data.service';
|
||||||
import { CollectionDropdownComponent } from '../../../shared/collection-dropdown/collection-dropdown.component';
|
import { CollectionDropdownComponent } from '../../../shared/collection-dropdown/collection-dropdown.component';
|
||||||
import { SectionsService } from '../../sections/sections.service';
|
import { SectionsService } from '../../sections/sections.service';
|
||||||
|
import { getFirstSucceededRemoteDataPayload } from '../../../core/shared/operators';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component allows to show the current collection the submission belonging to and to change it.
|
* This component allows to show the current collection the submission belonging to and to change it.
|
||||||
@@ -164,11 +165,17 @@ export class SubmissionFormCollectionComponent implements OnChanges, OnInit {
|
|||||||
this.submissionService.getSubmissionObjectLinkName(),
|
this.submissionService.getSubmissionObjectLinkName(),
|
||||||
this.submissionId,
|
this.submissionId,
|
||||||
'sections',
|
'sections',
|
||||||
'collection')
|
'collection').pipe(
|
||||||
.subscribe((submissionObject: SubmissionObject[]) => {
|
mergeMap((submissionObject: SubmissionObject[]) => {
|
||||||
|
// retrieve the full submission object with embeds
|
||||||
|
return this.submissionService.retrieveSubmission(submissionObject[0].id).pipe(
|
||||||
|
getFirstSucceededRemoteDataPayload()
|
||||||
|
);
|
||||||
|
})
|
||||||
|
).subscribe((submissionObject: SubmissionObject) => {
|
||||||
this.selectedCollectionId = event.collection.id;
|
this.selectedCollectionId = event.collection.id;
|
||||||
this.selectedCollectionName$ = observableOf(event.collection.name);
|
this.selectedCollectionName$ = observableOf(event.collection.name);
|
||||||
this.collectionChange.emit(submissionObject[0]);
|
this.collectionChange.emit(submissionObject);
|
||||||
this.submissionService.changeSubmissionCollection(this.submissionId, event.collection.id);
|
this.submissionService.changeSubmissionCollection(this.submissionId, event.collection.id);
|
||||||
this.processingChange$.next(false);
|
this.processingChange$.next(false);
|
||||||
this.cdr.detectChanges();
|
this.cdr.detectChanges();
|
||||||
|
Reference in New Issue
Block a user