diff --git a/src/app/core/data/item-data.service.ts b/src/app/core/data/item-data.service.ts index 80da91acb3..c3fa84dd6c 100644 --- a/src/app/core/data/item-data.service.ts +++ b/src/app/core/data/item-data.service.ts @@ -246,10 +246,10 @@ export abstract class BaseItemDataService extends IdentifiableDataService * Get the endpoint to move the item * @param itemId */ - public getMoveItemEndpoint(itemId: string): Observable { + public getMoveItemEndpoint(itemId: string, inheritPolicies: boolean): Observable { return this.halService.getEndpoint(this.linkPath).pipe( map((endpoint: string) => this.getIDHref(endpoint, itemId)), - map((endpoint: string) => `${endpoint}/owningCollection`), + map((endpoint: string) => `${endpoint}/owningCollection?inheritPolicies=${inheritPolicies}`) ); } @@ -258,14 +258,14 @@ export abstract class BaseItemDataService extends IdentifiableDataService * @param itemId * @param collection */ - public moveToCollection(itemId: string, collection: Collection): Observable> { + public moveToCollection(itemId: string, collection: Collection, inheritPolicies: boolean): Observable> { const options: HttpOptions = Object.create({}); let headers = new HttpHeaders(); headers = headers.append('Content-Type', 'text/uri-list'); options.headers = headers; const requestId = this.requestService.generateRequestId(); - const hrefObs = this.getMoveItemEndpoint(itemId); + const hrefObs = this.getMoveItemEndpoint(itemId, inheritPolicies); hrefObs.pipe( find((href: string) => hasValue(href)), diff --git a/src/app/item-page/edit-item-page/item-move/item-move.component.spec.ts b/src/app/item-page/edit-item-page/item-move/item-move.component.spec.ts index d200891629..43ac47e37b 100644 --- a/src/app/item-page/edit-item-page/item-move/item-move.component.spec.ts +++ b/src/app/item-page/edit-item-page/item-move/item-move.component.spec.ts @@ -134,9 +134,10 @@ describe('ItemMoveComponent', () => { }); comp.selectedCollectionName = 'selected-collection-id'; comp.selectedCollection = collection1; + comp.inheritPolicies = false; comp.moveToCollection(); - expect(itemDataService.moveToCollection).toHaveBeenCalledWith('item-id', collection1); + expect(itemDataService.moveToCollection).toHaveBeenCalledWith('item-id', collection1, false); }); it('should call notificationsService success message on success', () => { comp.moveToCollection(); diff --git a/src/app/item-page/edit-item-page/item-move/item-move.component.ts b/src/app/item-page/edit-item-page/item-move/item-move.component.ts index b7ab761fe5..4f53fa7df1 100644 --- a/src/app/item-page/edit-item-page/item-move/item-move.component.ts +++ b/src/app/item-page/edit-item-page/item-move/item-move.component.ts @@ -104,7 +104,7 @@ export class ItemMoveComponent implements OnInit { */ moveToCollection() { this.processing = true; - const move$ = this.itemDataService.moveToCollection(this.item.id, this.selectedCollection) + const move$ = this.itemDataService.moveToCollection(this.item.id, this.selectedCollection, this.inheritPolicies) .pipe(getFirstCompletedRemoteData()); move$.subscribe((response: RemoteData) => {