forked from hazza/dspace-angular
115046: Fixed incorrect name variant being saved in the store when marking relationship ready for deletion
This commit is contained in:
@@ -305,16 +305,16 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy {
|
|||||||
modalComp.submitEv = () => {
|
modalComp.submitEv = () => {
|
||||||
modalComp.isPending = true;
|
modalComp.isPending = true;
|
||||||
const isLeft = this.currentItemIsLeftItem$.getValue();
|
const isLeft = this.currentItemIsLeftItem$.getValue();
|
||||||
const addOperations = modalComp.toAdd.map((searchResult: any) => ({ type: 'add', searchResult }));
|
const addOperations = modalComp.toAdd.map((searchResult: ItemSearchResult) => ({ type: 'add', searchResult }));
|
||||||
const removeOperations = modalComp.toRemove.map((searchResult: any) => ({ type: 'remove', searchResult }));
|
const removeOperations = modalComp.toRemove.map((searchResult: ItemSearchResult) => ({ type: 'remove', searchResult }));
|
||||||
observableFrom([...addOperations, ...removeOperations]).pipe(
|
observableFrom([...addOperations, ...removeOperations]).pipe(
|
||||||
concatMap(({ type, searchResult }: { type: string, searchResult: any }) => {
|
concatMap(({ type, searchResult }: { type: string, searchResult: ItemSearchResult }) => {
|
||||||
|
const relatedItem: Item = searchResult.indexableObject;
|
||||||
if (type === 'add') {
|
if (type === 'add') {
|
||||||
const relatedItem = searchResult.indexableObject;
|
|
||||||
return this.relationshipService.getNameVariant(this.listId, relatedItem.uuid).pipe(
|
return this.relationshipService.getNameVariant(this.listId, relatedItem.uuid).pipe(
|
||||||
map((nameVariant) => {
|
map((nameVariant) => {
|
||||||
const update = {
|
const update = {
|
||||||
uuid: this.relationshipType.id + '-' + searchResult.indexableObject.uuid,
|
uuid: `${this.relationshipType.id}-${relatedItem.uuid}`,
|
||||||
nameVariant,
|
nameVariant,
|
||||||
type: this.relationshipType,
|
type: this.relationshipType,
|
||||||
originalIsLeft: isLeft,
|
originalIsLeft: isLeft,
|
||||||
@@ -327,7 +327,7 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy {
|
|||||||
take(1)
|
take(1)
|
||||||
);
|
);
|
||||||
} else if (type === 'remove') {
|
} else if (type === 'remove') {
|
||||||
return this.relationshipService.getNameVariant(this.listId, searchResult.indexableObjectuuid).pipe(
|
return this.relationshipService.getNameVariant(this.listId, relatedItem.uuid).pipe(
|
||||||
switchMap((nameVariant) => {
|
switchMap((nameVariant) => {
|
||||||
return this.getRelationFromId(searchResult.indexableObject).pipe(
|
return this.getRelationFromId(searchResult.indexableObject).pipe(
|
||||||
map( (relationship: Relationship) => {
|
map( (relationship: Relationship) => {
|
||||||
|
Reference in New Issue
Block a user