Bug/sc 28696/allow unsetting the license field on versions #2002
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.
Description
Allows user to unset the license field on versions using UI.
Code Changes
The existing line
{licenses.map(v => <option key={v} value={v}>{v?v:"(None Listed)"}</option>)}
means that a license value of "" will be shown as "(None Listed)", so I just had to add the line:let licenses = [...Object.keys(Sefaria.getLicenseMap()), ""];
to make sure the licenses array contained an empty string. (By the way, to make sure we don't end with two empty strings, I removed the property 'license' when its value was the empty string for 8 versions on prod).update_version
that gets called from two places in the API. Second, I added a line so that if license is set to the empty string, the property will be removed from the Version: