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

Make requested changes to the copyright and license fields #1399

Merged
merged 1 commit into from
Dec 9, 2024

Conversation

jazairi
Copy link
Contributor

@jazairi jazairi commented Dec 6, 2024

Why these changes are being introduced:

Stakeholders have requested that we preselect the 'author' copyright value, and make the license field conditionally required when that copyright value is selected.

Relevant ticket(s):

How this addresses that need:

This adds the selected property to the desired option in the copyright field. It also updates the conditionalLicenseField function to toggle the required property on the license field when it is shown or hidden.

Side effects of this change:

  • Past experience has made me wary of toggling the required prop in this way. However, it is generally reliable under a single binary condition (either the 'Author' copyright value is selected, or it isn't). I haven't noticed any issues in click-testing.
  • selected is tied to a value, so in this case we are preselecting the first option. This corresponds to 'Author' in both staging and prod, but it would be better to make an explicit association. If the data were to change order somehow, the wrong copyright holder could be preselected.

Developer

  • All new ENV is documented in README
  • All new ENV has been added to Heroku Pipeline, Staging and Prod
  • ANDI or Wave has been run in accordance to
    our guide and
    all issues introduced by these changes have been resolved or opened as new
    issues (link to those issues in the Pull Request details above)
  • Stakeholder approval has been confirmed (or is not needed)

Code Reviewer

  • The commit message is clear and follows our guidelines
    (not just this pull request message)
  • There are appropriate tests covering any new functionality
  • The documentation has been updated or is unnecessary
  • The changes have been verified
  • New dependencies are appropriate or there were no changes

Requires database migrations?

NO

Includes new or updated dependencies?

NO

@mitlib mitlib temporarily deployed to thesis-submit-pr-1399 December 6, 2024 21:21 Inactive
@coveralls
Copy link

coveralls commented Dec 6, 2024

Coverage Status

coverage: 98.313%. remained the same
when pulling 671efa1 on etd-627-update-copyright
into 694d3e5 on main.

@mitlib mitlib temporarily deployed to thesis-submit-pr-1399 December 9, 2024 14:24 Inactive
@@ -124,6 +124,7 @@
</div>

<%= f.association :copyright, as: :select,
selected: 1,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jazairi It looks like we set the ID is consistent in the PR builds as well so while not ideal, it's probably a risk we can accept as there is little reason we'd be changing the Author copyright to be something inherently different under the good.

That said, I believe this ID is wrong as Author is ID 2 (in the PR build and prod at least).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JPrevost Thanks for pointing that out! While fixing that, I noticed that I'd forgotten to include license validation/required field indicator in the edit view, so I added that, too.

@jazairi jazairi temporarily deployed to thesis-submit-pr-1399 December 9, 2024 15:44 Inactive
@jazairi jazairi requested a review from JPrevost December 9, 2024 15:45
@JPrevost JPrevost self-assigned this Dec 9, 2024
@@ -124,6 +124,7 @@
</div>

<%= f.association :copyright, as: :select,
selected: 2,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if for the edit view we can do something like selected: 2 if license.nil? (not real code). My reasoning is that because of the registrar data load pre-creating theses, I think most users hit the edit form and not the new form.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good point. I'll see what options we have there.

Copy link
Member

@JPrevost JPrevost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks and works as expected.

I added a comment as to whether we can figure out how to make the feature work safely for the edit form. If not, I can approve as-is. But if we can make edit work safely (i.e. only override selection if no data exists for that field) that would be better.

@jazairi jazairi temporarily deployed to thesis-submit-pr-1399 December 9, 2024 20:54 Inactive
@jazairi
Copy link
Contributor Author

jazairi commented Dec 9, 2024

@JPrevost I think the latest commit addresses your concern about the edit form. It's a bit kludgy to preselect the associated copyright, but without that condition, that field would be blank if the thesis already had a copyright.

@jazairi jazairi requested a review from JPrevost December 9, 2024 20:58
Copy link
Member

@JPrevost JPrevost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works how I think it makes sense... let's hope when you check in with stakeholders it's what they meant :)

Thanks for taking the extra time to make the tweaks!

Why these changes are being introduced:

Stakeholders have requested that we preselect the 'author' copyright
value, and make the license field conditionally required when
that copyright value is selected.

Relevant ticket(s):

* [ETD-627](https://mitlibraries.atlassian.net/browse/ETD-627)

How this addresses that need:

This adds the `selected` property to the desired option in
the copyright field. It also updates the `conditionalLicenseField`
function to toggle the `required` property on the license field when
it is shown or hidden.

Side effects of this change:

* Past experience has made me wary of toggling the `required` prop
in this way. However, it is generally reliable under a single
binary condition (either the 'Author' copyright value is selected,
or it isn't). I haven't noticed any issues in click-testing.
* `selected` is tied to a value, so in this case we are preselecting
the first option. This corresponds to 'Author' in both staging and
prod, but it would be better to make an explicit association. If
the data were to change order somehow, the wrong copyright holder
could be preselected.
@jazairi jazairi force-pushed the etd-627-update-copyright branch from e5ce406 to 671efa1 Compare December 9, 2024 21:39
@jazairi jazairi temporarily deployed to thesis-submit-pr-1399 December 9, 2024 21:39 Inactive
@jazairi jazairi merged commit 7d1339a into main Dec 9, 2024
3 checks passed
@jazairi jazairi deleted the etd-627-update-copyright branch December 9, 2024 21:41
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 this pull request may close these issues.

4 participants