Skip to content

Commit f54a618

Browse files
milanmajchrakclaude
andcommitted
UoE/datashare: address Copilot review - pass keepEmbargoPolicies through directly
getMoveItemEndpoint already omits keepEmbargoPolicies unless inheriting, so the component no longer needs the 'inheritPolicies ? keepEmbargoPolicies : true' conditional - it passes keepEmbargoPolicies straight through. Also reword the spec comment (keepEmbargoPolicies defaults to true and is only sent when inheriting). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 9c6d274 commit f54a618

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/app/item-page/edit-item-page/item-move/item-move.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ describe('ItemMoveComponent', () => {
150150
comp.inheritPolicies = false;
151151
comp.moveToCollection();
152152

153-
// keepEmbargoPolicies is only meaningful when inheriting; not inheriting always sends true
153+
// keepEmbargoPolicies defaults to true; it is only sent on the request URL when inheriting
154154
expect(itemDataService.moveToCollection).toHaveBeenCalledWith('item-id', collection1, false, true);
155155
});
156156
it('should pass keepEmbargoPolicies through when inheriting policies', () => {

src/app/item-page/edit-item-page/item-move/item-move.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,10 @@ export class ItemMoveComponent implements OnInit {
152152
*/
153153
moveToCollection() {
154154
this.processing = true;
155+
// keepEmbargoPolicies is only sent (and only matters) when inheriting; getMoveItemEndpoint omits
156+
// it otherwise, so we can pass it straight through.
155157
const move$ = this.itemDataService.moveToCollection(
156-
this.item.id, this.selectedCollection, this.inheritPolicies,
157-
this.inheritPolicies ? this.keepEmbargoPolicies : true,
158+
this.item.id, this.selectedCollection, this.inheritPolicies, this.keepEmbargoPolicies,
158159
).pipe(getFirstCompletedRemoteData());
159160

160161
move$.subscribe((response: RemoteData<any>) => {

0 commit comments

Comments
 (0)