Skip to content

fix(#1003): fallback to draft version on dataset page when no version… - #1068

Open
Janvi-kapoor wants to merge 1 commit into
IQSS:developfrom
Janvi-kapoor:1003-dataset-draft-fallback
Open

fix(#1003): fallback to draft version on dataset page when no version…#1068
Janvi-kapoor wants to merge 1 commit into
IQSS:developfrom
Janvi-kapoor:1003-dataset-draft-fallback

Conversation

@Janvi-kapoor

Copy link
Copy Markdown

What this PR does / why we need it:

When accessing a dataset page without an explicit version query parameter, the repository defaults to fetching :latest-published. For draft-only datasets, this request returns a 404 error, preventing authorized users (such as creators accessing datasets from notifications) from viewing their draft dataset.

This PR updates DatasetJSDataverseRepository.getByPersistentId:

  • When no requestedVersion is provided and the initial :latest-published request fails, it attempts a fallback to :draft.
  • If the :draft request also fails (e.g. for unauthorized users lacking draft-view permissions), it throws the error normally.
  • If an explicit version was requested, existing behavior remains unchanged.

Which issue(s) this PR closes:

Special notes for your reviewer:

  • Handled at the repository layer (DatasetJSDataverseRepository) as discussed in the issue thread.
  • Preserves existing fallback logic when explicit versions are supplied.

Suggestions on how to test this:

  1. Create a draft-only dataset.
  2. Navigate to the dataset URL without a version query parameter (/datasets?persistentId=<doi>).
  3. Verify that the draft version loads successfully for authorized users instead of throwing a 404 error.
  4. Access the same URL as an anonymous/unauthorized user and verify that the request fails as expected.

Does this PR introduce a user interface change? If mockups are available, please link/include them here:

No.

Is there a release notes or changelog update needed for this change?:

Yes, updated CHANGELOG.md under [Unreleased] -> ### Fixed.

Additional documentation:

None.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready for Triage

Development

Successfully merging this pull request may close these issues.

Dataset Page: show "only draft" version if user has permission

2 participants