Merged
Conversation
scolapasta
reviewed
Aug 12, 2022
Contributor
scolapasta
left a comment
There was a problem hiding this comment.
@qqmyers very, vey minor - in one place you added datasetPage, and in the other "datasetPage == true". Both do the same thing, but can we keep them consistent? While I normally prefer the former, in this case, I feel the latter may be easier to read? Bit I'm fine with either.
Closed
Member
Author
|
OK - I added == true above. There are still uses of both forms (with/without == true on the page). |
scolapasta
approved these changes
Aug 12, 2022
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.
What this PR does / why we need it: Fixes NPEs introduced in #8902
Which issue(s) this PR closes:
Closes #8916
Special notes for your reviewer: After some investigation, it appears that two of the calls replaced with DatasetPage.hasRestrictedFiles in #8902 were 'working' because nulls in the xhtml logic were being ignored, i.e. in dataset-license-terms.xhtml
line 251: DatasetPage.restrictedFileCount returns 0 if the workingVersion is null (true on the template page, so the count of the # of restricted files HTML is suppressed on the template page.
line 267 - same logic appears to be accidentally suppressing any terms of access in the view mode for a template page. (not fixed in this PR)
line 310 (prior to this PR): DatasetPage.dataset.editVersion.hasRestrictedFile ~worked on the template page because DatasetPage creates an empty Dataset when initializing the dataset variable and editVersion would then create a datasetversion for the empty dataset and its hasRestrictedFile method them reports false, with the net effect of appropriately suppressing the info about needed access requests or ToA.
This PR keeps the changes in #8902 and adds a check of datasetPage (a variable that is only true when this fragment is included from a dataset page) prior to DatasetPage.hasRestrictedFiles which avoids having it called from the template page. This pattern is already done elsewhere in the dataset-license-terms.xhtml file.
In working through this, I did note the line 267 issue above (terms of access set in a template are not show in the template/view mode) as well as other issues (collapse state isn't set correctly due to use of jsf:class instead of class, no display of template fileaccessrequest status) - rather than bloat this PR or potentially miss other related issues, I'll open an issue to review what should be happening in the template view and note these as an initial list.
Suggestions on how to test this: Test the scenario in #8916 as well as verifying that there is no null pointer exception when viewing a template with terms of access and/or data place terms added.
Does this PR introduce a user interface change? If mockups are available, please link/include them here: no
Is there a release notes update needed for this change?:
Additional documentation: