mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
80195: Refresh moved Item's owningCollection before redirecting
This commit is contained in:
@@ -48,11 +48,13 @@ describe('ItemMoveComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const mockItemDataService = jasmine.createSpyObj({
|
const mockItemDataService = jasmine.createSpyObj({
|
||||||
moveToCollection: createSuccessfulRemoteDataObject$(collection1)
|
moveToCollection: createSuccessfulRemoteDataObject$(collection1),
|
||||||
|
findById: createSuccessfulRemoteDataObject$(mockItem),
|
||||||
});
|
});
|
||||||
|
|
||||||
const mockItemDataServiceFail = jasmine.createSpyObj({
|
const mockItemDataServiceFail = jasmine.createSpyObj({
|
||||||
moveToCollection: createFailedRemoteDataObject$('Internal server error', 500)
|
moveToCollection: createFailedRemoteDataObject$('Internal server error', 500),
|
||||||
|
findById: createSuccessfulRemoteDataObject$(mockItem),
|
||||||
});
|
});
|
||||||
|
|
||||||
const routeStub = {
|
const routeStub = {
|
||||||
|
@@ -14,6 +14,7 @@ import { Observable, of as observableOf } from 'rxjs';
|
|||||||
import { Collection } from '../../../core/shared/collection.model';
|
import { Collection } from '../../../core/shared/collection.model';
|
||||||
import { SearchService } from '../../../core/shared/search/search.service';
|
import { SearchService } from '../../../core/shared/search/search.service';
|
||||||
import { getItemEditRoute, getItemPageRoute } from '../../item-page-routing-paths';
|
import { getItemEditRoute, getItemPageRoute } from '../../item-page-routing-paths';
|
||||||
|
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-item-move',
|
selector: 'ds-item-move',
|
||||||
@@ -93,13 +94,17 @@ export class ItemMoveComponent implements OnInit {
|
|||||||
.pipe(getFirstCompletedRemoteData())
|
.pipe(getFirstCompletedRemoteData())
|
||||||
.subscribe(
|
.subscribe(
|
||||||
(response: RemoteData<any>) => {
|
(response: RemoteData<any>) => {
|
||||||
this.router.navigate([getItemEditRoute(this.item)]);
|
this.itemDataService.findById(
|
||||||
|
this.item.id, false, true, followLink('owningCollection', undefined, true, false)
|
||||||
|
).subscribe(() => {
|
||||||
|
this.processing = false;
|
||||||
|
this.router.navigate([getItemEditRoute(this.item)]);
|
||||||
|
});
|
||||||
if (response.hasSucceeded) {
|
if (response.hasSucceeded) {
|
||||||
this.notificationsService.success(this.translateService.get('item.edit.move.success'));
|
this.notificationsService.success(this.translateService.get('item.edit.move.success'));
|
||||||
} else {
|
} else {
|
||||||
this.notificationsService.error(this.translateService.get('item.edit.move.error'));
|
this.notificationsService.error(this.translateService.get('item.edit.move.error'));
|
||||||
}
|
}
|
||||||
this.processing = false;
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user