UoE/datashare: add "Keep embargo policies" option to the move-item screen#20
Conversation
…reen Companion to backend PR dataquest-dev/uoe-dspace-datashare-backend#27 (dspace-customers#761 - embargo lost when moving into another collection). When moving an item and inheriting the destination collection's policies, let the user choose whether to keep an existing embargo: - checked (default): inherit everything except the embargo (keepEmbargoPolicies=true) - unchecked: plain DSpace behaviour - inherited default read lifts the embargo The checkbox is shown only when "Inherit policies" is ticked. - item-move.component: keepEmbargoPolicies model (default true), passed to moveToCollection only when inheriting. - item-move.component.html: checkbox + description gated on inheritPolicies. - item-data.service: send &keepEmbargoPolicies= on the owningCollection move. - en.json5: item.edit.move.keepembargopolicies.{checkbox,description,tooltip}. - item-move.component.spec: updated expectation + case for inheriting. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds a “Keep embargo policies” option to the Item → Edit → Move flow, allowing users who choose Inherit policies to preserve an existing embargo during the move (via a new keepEmbargoPolicies request param).
Changes:
- Adds a
keepEmbargoPoliciesUI model (defaulttrue) and conditionally displays a checkbox wheninheritPoliciesis enabled. - Extends the move request URL generation / API call to include
keepEmbargoPolicies. - Adds English i18n strings and updates unit tests to assert the new parameter is passed through.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/assets/i18n/en.json5 | Adds new i18n keys for the checkbox label/description/tooltip |
| src/app/item-page/edit-item-page/item-move/item-move.component.ts | Adds keepEmbargoPolicies state and passes it into the move call |
| src/app/item-page/edit-item-page/item-move/item-move.component.html | Adds checkbox + help text, shown only when inheriting policies |
| src/app/item-page/edit-item-page/item-move/item-move.component.spec.ts | Updates/extends tests to validate new moveToCollection args |
| src/app/core/data/item-data.service.ts | Appends keepEmbargoPolicies query param to the move endpoint and wires it through |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "item.edit.move.keepembargopolicies.checkbox": "Keep embargo policies", | ||
|
|
||
| "item.edit.move.keepembargopolicies.description": "When inheriting policies, keep any existing embargo: only the non-embargo access is inherited from the destination collection.", | ||
|
|
||
| "item.edit.move.keepembargopolicies.tooltip": "When enabled, inheriting the destination collection's policies preserves an existing embargo, so embargoed files stay embargoed until their original lift date. When disabled, the inherited default read access replaces (and lifts) the embargo.", |
There was a problem hiding this comment.
These keys are added to en.json5 only, matching this repo's convention for new custom keys: the recent DataShare feature commits (embargo badge, hide download-all button, a11y fixes) each touch only en.json5. Other locales are propagated with the repo's sync-i18n script (which adds new keys under a '// TODO New key' marker) at merge/release time; running it per-feature here would also pull in every other not-yet-synced key and create a large unrelated diff. So I've kept this PR to en.json5 and left locale propagation to the existing sync workflow.
| public getMoveItemEndpoint(itemId: string, inheritPolicies: boolean, keepEmbargoPolicies = true): Observable<string> { | ||
| return this.halService.getEndpoint(this.linkPath).pipe( | ||
| map((endpoint: string) => this.getIDHref(endpoint, itemId)), | ||
| map((endpoint: string) => `${endpoint}/owningCollection?inheritPolicies=${inheritPolicies}`), | ||
| map((endpoint: string) => | ||
| `${endpoint}/owningCollection?inheritPolicies=${inheritPolicies}&keepEmbargoPolicies=${keepEmbargoPolicies}`), | ||
| ); |
There was a problem hiding this comment.
Done in the latest commit — getMoveItemEndpoint now only appends keepEmbargoPolicies when inheritPolicies is true (it has no effect otherwise), keeping the URL minimal.
… when inheriting getMoveItemEndpoint now appends keepEmbargoPolicies to the move URL only when inheritPolicies is true (the flag has no effect otherwise), keeping the request URL minimal and the semantics clear. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| const move$ = this.itemDataService.moveToCollection( | ||
| this.item.id, this.selectedCollection, this.inheritPolicies, | ||
| this.inheritPolicies ? this.keepEmbargoPolicies : true, | ||
| ).pipe(getFirstCompletedRemoteData()); |
There was a problem hiding this comment.
Done — the component now passes keepEmbargoPolicies straight through. getMoveItemEndpoint already omits it unless inheritPolicies is true, so the conditional was redundant.
| // keepEmbargoPolicies is only meaningful when inheriting; not inheriting always sends true | ||
| expect(itemDataService.moveToCollection).toHaveBeenCalledWith('item-id', collection1, false, true); |
There was a problem hiding this comment.
Reworded — the comment now says keepEmbargoPolicies defaults to true and is only sent on the request URL when inheriting.
…ugh 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>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| public getMoveItemEndpoint(itemId: string, inheritPolicies: boolean, keepEmbargoPolicies = true): Observable<string> { | ||
| return this.halService.getEndpoint(this.linkPath).pipe( | ||
| map((endpoint: string) => this.getIDHref(endpoint, itemId)), | ||
| map((endpoint: string) => `${endpoint}/owningCollection?inheritPolicies=${inheritPolicies}`), | ||
| map((endpoint: string) => { | ||
| let href = `${endpoint}/owningCollection?inheritPolicies=${inheritPolicies}`; | ||
| // Only relevant when inheriting. | ||
| if (inheritPolicies) { | ||
| href += `&keepEmbargoPolicies=${keepEmbargoPolicies}`; | ||
| } | ||
| return href; | ||
| }), |
There was a problem hiding this comment.
Added getMoveItemEndpoint tests to item-data.service.spec.ts asserting keepEmbargoPolicies is appended only when inheritPolicies is true (and omitted otherwise).
Assert keepEmbargoPolicies is appended only when inheriting policies. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
What
Adds a "Keep embargo policies" checkbox to the Move item screen (Edit item → Move) — the companion frontend for backend PR dataquest-dev/uoe-dspace-datashare-backend#27, which addresses dataquest-dev/dspace-customers#761 ("Embargo is lost when moving into another collection").
When moving an item and inheriting the destination collection's policies, the option lets the user choose whether to keep an existing embargo:
keepEmbargoPolicies=true).The checkbox is shown only when "Inherit policies" is ticked, since keeping an embargo is only meaningful when inheriting.
Changes
item-move.component.ts: newkeepEmbargoPoliciesmodel (defaulttrue), passed tomoveToCollection(only meaningful when inheriting).item-move.component.html: "Keep embargo policies" checkbox + description, shown via*ngIf="inheritPolicies".item-data.service.ts:getMoveItemEndpoint/moveToCollectionappend&keepEmbargoPolicies=...to the owningCollection move request.en.json5:item.edit.move.keepembargopolicies.{checkbox,description,tooltip}.item-move.component.spec.ts: updated the existing expectation and added a case assertingkeepEmbargoPoliciesis passed through when inheriting.🤖 Generated with Claude Code