[Port to dtq-dev] add New version button for archived submission items#1278
Merged
milanmajchrak merged 3 commits intoJun 3, 2026
Merged
Conversation
* add New version action for archived submission items add New version action for archived submission items * Use shareReplay to cache version draft observable Import shareReplay and apply .pipe(shareReplay(1)) to the version draft observable in ItemActionsComponent. This shares the subscription and caches the latest emission so multiple subscribers won't trigger duplicate work or requests. * Derive new-version tooltip from disable state Use the disableNewVersion$ observable to compute newVersionTooltip$ (with map) and apply shareReplay to disableNewVersion$, instead of calling getVersioningTooltipMessage unconditionally. This avoids invoking the tooltip service when the button is disabled. Added map import and updated unit test to assert the tooltip is derived from the disabled state and that getVersioningTooltipMessage is not called. (cherry picked from commit 3fb57f1)
There was a problem hiding this comment.
Pull request overview
Adds a “New version” action to the MyDSpace item actions UI, enabling authorized users to create a new version for (archived) items directly from the MyDSpace context.
Changes:
- Introduces versioning authorization/state streams (
canCreateVersion$,disableNewVersion$,newVersionTooltip$) and a click handler to open the existing versioning modal. - Updates the item actions template to conditionally render a “New version” button with disabled state + tooltip.
- Extends unit tests to cover visibility/disabled state/tooltip derivation and modal opening behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/app/shared/mydspace-actions/item/item-actions.component.ts |
Adds versioning authorization checks, disabled/tooltip observables, and a method to open the create-version modal. |
src/app/shared/mydspace-actions/item/item-actions.component.html |
Renders a conditional “New version” button with tooltip and aria-label bindings. |
src/app/shared/mydspace-actions/item/item-actions.component.spec.ts |
Adds tests for the new button’s visibility/disabled state/tooltip logic and click behavior. |
milanmajchrak
requested changes
May 6, 2026
Replace the inline mapping of disableNewVersion$ to compute the tooltip with dsoVersioningModalService.getVersioningTooltipMessage(this.object, 'item.page.version.hasDraft', 'item.page.version.create'), centralizing tooltip logic in the service. Also remove the now-unused rxjs 'map' import; shareReplay usage for disableNewVersion$ is preserved.
Collaborator
|
@amadulhaxxani The tests are failing. Would you have capacity to look into this, please? |
|
@milanmajchrak |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port of ufal#130 by @amadulhaxxani to
dtq-dev.