-
Notifications
You must be signed in to change notification settings - Fork 87
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
pids: skip modifications when no data is passed #1139
Conversation
if "pids" in data: | ||
pids = data.get("pids", {}) | ||
else: | ||
pids = record.pids or {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you test the use case (currently via the UI):
- Fill in an external pid
- Save
- Change your answer from "yes" to "no" without reserving a doi
- Save again. Payload sent is skipping the
pids
key entirely and the UI expects the backend to reserve one when the record is published!
7f3667a
to
899c3ee
Compare
pids = data.get("pids", {}) | ||
self.service.pids.pid_manager.validate(pids, record, errors) | ||
record.pids = pids | ||
pids_data = record.pids or {} # current pids state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you test what I described here #1139 (comment) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right, this currently breaks in the upload form. I.e. you publish the record with the external DOI that was entered and saved in steps 1 + 2 (even though you choose "No" and click Save).
To move forward, we can either:
- Skip this change (there are some implications in Zenodo Legacy REST API PR for that to work, but it's possible)
- Change in the upload form if the user selects "No" to serialize an empty
pids: {}
on the next "Save". - Accept this edge case bug for now until we have a clear vision on what to do with PUT semantics
record.pids = pids | ||
pids_data = record.pids or {} # current pids state | ||
if "pids" in data: # there is new input data for PIDs | ||
pids_data = data.get("pids", {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pids_data = data.get("pids", {}) | |
pids_data = data["pids"] |
record.pids = pids | ||
pids_data = record.pids or {} # current pids state | ||
if "pids" in data: # there is new input data for PIDs | ||
pids_data = data.get("pids", {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pids_data = data.get("pids", {}) | |
pids_data = data["pids"] |
Closes zenodo/zenodo-rdm#99.
depends on inveniosoftware/react-invenio-deposit#612
❤️ Thank you for your contribution!
Description
Please describe briefly your pull request.
Checklist
Ticks in all boxes and 🟢 on all GitHub actions status checks are required to merge:
Third-party code
If you've added third-party code (copy/pasted or new dependencies), please reach out to an architect.
Reminder
By using GitHub, you have already agreed to the GitHub’s Terms of Service including that: