Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/app/core/data/item-data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,10 @@ export abstract class BaseItemDataService extends IdentifiableDataService<Item>
* Get the endpoint to move the item
* @param itemId
*/
public getMoveItemEndpoint(itemId: string): Observable<string> {
public getMoveItemEndpoint(itemId: string, inheritPolicies: boolean): Observable<string> {
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}`)
);
}

Expand All @@ -258,14 +258,14 @@ export abstract class BaseItemDataService extends IdentifiableDataService<Item>
* @param itemId
* @param collection
*/
public moveToCollection(itemId: string, collection: Collection): Observable<RemoteData<any>> {
public moveToCollection(itemId: string, collection: Collection, inheritPolicies: boolean): Observable<RemoteData<any>> {
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)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<any>) => {
Expand Down