Skip to content

Create new version button disabled when no new version in progress #2720

@MarieVerdonck

Description

@MarieVerdonck

Describe the bug
If an item already has 1 or more (completed) versions the create new version is disabled claiming there is a version in progress, even when there is not.
Example item: https://demo.dspace.org/items/22d80b2d-c82b-46bf-b052-2c0648848ef2 (as dspace admin that created & deposited the second version)

To Reproduce
Steps to reproduce the behavior (As DSpace Admin):

  1. Create new version of an item without any versions
  2. Deposit version
  3. Go to the latest version page
  4. The create new version button is disabled

Expected behavior
This button should only be disabled if there is a new version of the item already in progress in either workspace or workflow (regardless of which user is creating this version should be disabled for all users that are creating the version, perhaps for the user creating the version this button could be to resume the workspace/workflow item, but would be out of scope for this bug fix)

Likely cause/possible solution
This button uses versionhistory.draftVersion in version-history-data.service.ts hasDraftVersion$ here to check whether or not there is a version in progress, but something likely goes wrong there, & the startWith(true) is likely used here

VersionHistory modal in Angular assumes draftVersion contains just boolean on whether or not there is a draft version, but rather it contains the draft version item if it exists and user is allowed to access it, otherwise doesn't resolve (either gives 204 no content or not authorised error) => See VersionHistoryDraftVersionLinkRepository

Example when there is no draft: https://demo.dspace.org/server/#https://demo.dspace.org/server/api/core/items/22d80b2d-c82b-46bf-b052-2c0648848ef2/version?embed=versionhistory => draftVersion

Needs a new property on endpoint indicating whether or not the is a version in progress regardless of whether or not it can be accessed by user

Related work
https://github.com/DSpace/dspace-angular/pull/1318/commits

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

✅ Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions