Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File Previews don't show in page if a draft version exists #6419

Closed
qqmyers opened this issue Nov 26, 2019 · 6 comments · Fixed by #6420
Closed

File Previews don't show in page if a draft version exists #6419

qqmyers opened this issue Nov 26, 2019 · 6 comments · Fixed by #6420

Comments

@qqmyers
Copy link
Member

qqmyers commented Nov 26, 2019

When viewing an unrestricted file in a published dataset, if a draft dataset exists, the preview tab does not display. And, if that is fixed, the previewer tries to load the draft dataset version and fails.

Digging in, it looks like there are two places where getLastestFilemetadata is getting called (directly or indirectly) and leading to these failures. In the FilePage, the init() method correctly picks the filemetadata for the requested version, but the preview() method was using file.getFileMetadata() which gets the draft version. (The second issue above).
In file.xhtml, there is a render check requiring the FilePage.filemetadata.datasetversion (e.g. 1.0) to be equal to the latestversion of the dataset (e.g. draft in this case).

I'll submit a PR with updates for both which work for me to make the preview tab show for this case. (Question - was the design to not allow prior versions to be previewed? I.e. is checking that the datasetversion is the latest public version what was intended?).

@pdurbin
Copy link
Member

pdurbin commented Nov 26, 2019

@qqmyers sounds find to me but just a heads up that we went back and forth with this notion of having the Preview tab with non-public files or not in pull request #6325 . See c35268b and 29a7edc especially and #6325 (comment)

@qqmyers
Copy link
Member Author

qqmyers commented Nov 26, 2019

@pdurbin - this is not about showing non-public files. The presence of a draft version makes the published version un-previewable.

@pdurbin
Copy link
Member

pdurbin commented Nov 26, 2019

Oh dear. Yes, a pull request would be much appreciated! 🎉

@qqmyers
Copy link
Member Author

qqmyers commented Nov 26, 2019

@pdurbin - do you know the answer to my question above? I think the version test in file.xhtml (after my fix for the draft issue) will still stop you from previewing a file in v1.0 if a later published version exists (e.g. v2.0).

@pdurbin
Copy link
Member

pdurbin commented Nov 26, 2019

@qqmyers sorry, I don't know. And I forget what getLatestVersionForCopy in your pull request does. I'm hoping @sekmiller or @scolapasta will take a look. 😄

At a high level, my understanding is that for the Preview tab we are reusing some logic from when we show "Download URL" like this (no guestbook, no restrictions, etc.):

Screen Shot 2019-11-26 at 4 04 25 PM

But I could be off or the thinking could have changed. I'm not sure. So I should probably stop making noise in here. 😄

@qqmyers
Copy link
Member Author

qqmyers commented Nov 26, 2019

getLatestedVersionForCopy just returns the latest version that is released or archived, so it doesn't pick up a draft version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants