[ENG-3872] Fix dataverse 502s and pass version info to FE#9959
Conversation
| ) | ||
| for dataverse_file in dataverse_files: | ||
| dataverse_file.update(None, attrs, user=self.request.user, save=False) | ||
| file_objs.append(dataverse_file) |
There was a problem hiding this comment.
I see that this is maintaining legacy behavior, but is it worth considering a follow-up fix to only return one version (based on the perms of request.user?)
There was a problem hiding this comment.
It's unclear, we need to discuss it more, kind of Product question as to how drafts are to be displayed.
e4472ba to
c6413f0
Compare
| def test_disambiguate_dataverse_paths_retrieve(self, app, user, node, dataverse, dataverse_draft_filenode, dataverse_published_filenode): | ||
| ''' | ||
| This test is for retrieving files from Dataverse and disambiguating thier corresponding OSF filenodes and | ||
| ensures their `extra` info is passed along to the front-end. |
There was a problem hiding this comment.
Add note about why we still need to provide the data via WB even though FileNodes exist?
52c885d to
9276bcd
Compare
4c14c64 to
2a39334
Compare
| extras['downloads'] = obj.get_download_count() | ||
|
|
||
| if obj.provider == 'dataverse': | ||
| extras.update(obj.history[0]['extra']) |
There was a problem hiding this comment.
Why history[0] instead of history[-1]?
There was a problem hiding this comment.
That's just a dumb bug, sorry!
|
|
||
| # overrides ListAPIView | ||
| def get_queryset(self): | ||
| def param_queryset(self, query_params, default_queryset): |
There was a problem hiding this comment.
My concern with this change is that we're taking the effort to evaluate the default_queryset and pass it in here only to ignore it in the info case -- and then we're going to try to annotate the result unnecessarily/incorrectly when it gets returned to get_queryset.
The old logic was a weird short-circuit for an arguably unneeded use case, but at least it was a short-circuit.
There was a problem hiding this comment.
Good point I hadn't considered that the default QS would have to be queried anyway, I'll just take out that branch of logic.
7729b7e to
6039d3e
Compare
…OpenScience/osf.io into load-lincenses * 'feature/django_upgrade' of https://github.com/CenterForOpenScience/osf.io: remove post-migrate signals from migration stream (CenterForOpenScience#9964) Add better logic for routing Dataverse files and their stupid duplicate (CenterForOpenScience#9963) [ENG-3872] Fix dataverse 502s and pass version info to FE (CenterForOpenScience#9959) Fix File `show_as_unviewed` behavior (CenterForOpenScience#9960) Fix OSFUser.has_resources ensure VOL users always get read perms (CenterForOpenScience#9952) make types correspond more to serializer code (CenterForOpenScience#9955) remove special casing from DV permissions (CenterForOpenScience#9947)
…OpenScience/osf.io into signal-storage-region * 'feature/django_upgrade' of https://github.com/CenterForOpenScience/osf.io: remove post-migrate signals from migration stream (CenterForOpenScience#9964) Add better logic for routing Dataverse files and their stupid duplicate (CenterForOpenScience#9963) [ENG-3872] Fix dataverse 502s and pass version info to FE (CenterForOpenScience#9959) Fix File `show_as_unviewed` behavior (CenterForOpenScience#9960) Fix OSFUser.has_resources ensure VOL users always get read perms (CenterForOpenScience#9952) make types correspond more to serializer code (CenterForOpenScience#9955) remove special casing from DV permissions (CenterForOpenScience#9947) Add a generic demo institution on the test server Don't send empty affiliations list to Datacite or Crossref Update pre-commit config to specify py version Fix DOI conditional Bump version and update CHANGELOG Update sc to use new SSO IdP [ENG-3832] Add redirect based for unauthed files page user (CenterForOpenScience#9948) [ENG-3781] Admin Registration Schemas (CenterForOpenScience#9937)
…OpenScience/osf.io into investigate-waffle-flags * 'feature/django_upgrade' of https://github.com/CenterForOpenScience/osf.io: move createcachetable to post migrate signal (CenterForOpenScience#9944) remove post-migrate signals from migration stream (CenterForOpenScience#9964) Add better logic for routing Dataverse files and their stupid duplicate (CenterForOpenScience#9963) [ENG-3872] Fix dataverse 502s and pass version info to FE (CenterForOpenScience#9959) Fix File `show_as_unviewed` behavior (CenterForOpenScience#9960) # Conflicts: # osf/apps.py # osf/migrations/0137_transfer_preprint_service_permissions.py # osf/migrations/__init__.py
…OpenScience/osf.io into signal-deny-list * 'feature/django_upgrade' of https://github.com/CenterForOpenScience/osf.io: move createcachetable to post migrate signal (CenterForOpenScience#9944) remove post-migrate signals from migration stream (CenterForOpenScience#9964) Add better logic for routing Dataverse files and their stupid duplicate (CenterForOpenScience#9963) [ENG-3872] Fix dataverse 502s and pass version info to FE (CenterForOpenScience#9959) Fix File `show_as_unviewed` behavior (CenterForOpenScience#9960) # Conflicts: # osf/apps.py # osf/migrations/0137_transfer_preprint_service_permissions.py # osf/migrations/__init__.py
…OpenScience/osf.io into signal-deny-list * 'feature/django_upgrade' of https://github.com/CenterForOpenScience/osf.io: move createcachetable to post migrate signal (CenterForOpenScience#9944) remove post-migrate signals from migration stream (CenterForOpenScience#9964) Add better logic for routing Dataverse files and their stupid duplicate (CenterForOpenScience#9963) [ENG-3872] Fix dataverse 502s and pass version info to FE (CenterForOpenScience#9959) Fix File `show_as_unviewed` behavior (CenterForOpenScience#9960) # Conflicts: # osf/apps.py # osf/migrations/0137_transfer_preprint_service_permissions.py # osf/migrations/__init__.py
into fix-mailchimp * 'develop' of https://github.com/CenterForOpenScience/osf.io: (73 commits) [ENG-3898][ENG-3899]Model support for OutcomeArtifact update and delete (CenterForOpenScience#9989) Make OutcomeArtifact.identifier nullable (CenterForOpenScience#9986) [ENG-3894] Outcome models (CenterForOpenScience#9975) revert color picker to working version (CenterForOpenScience#9968) Instrument the ORCiD SSO affiliation flow * Existing user with verified ORCiD ID * Existing user confirmation of linking ORCiD ID * New user confirmation of account creation with ORCiD ID Add a django command script to handle instn sso email domain changes Bump version and CHANGELOG Add better logic for routing Dataverse files and their stupid duplicate (CenterForOpenScience#9963) [ENG-3872] Fix dataverse 502s and pass version info to FE (CenterForOpenScience#9959) Fix File `show_as_unviewed` behavior (CenterForOpenScience#9960) Fix OSFUser.has_resources ensure VOL users always get read perms (CenterForOpenScience#9952) make types correspond more to serializer code (CenterForOpenScience#9955) remove special casing from DV permissions (CenterForOpenScience#9947) Add a generic demo institution on the test server Don't send empty affiliations list to Datacite or Crossref Update pre-commit config to specify py version Fix DOI conditional Bump version and update CHANGELOG Update sc to use new SSO IdP ... # Conflicts: # website/templates/profile/notifications.mako
into add-doi-domain * 'develop' of https://github.com/CenterForOpenScience/osf.io: (126 commits) [ENG-3898][ENG-3899]Model support for OutcomeArtifact update and delete (CenterForOpenScience#9989) Make OutcomeArtifact.identifier nullable (CenterForOpenScience#9986) [ENG-3894] Outcome models (CenterForOpenScience#9975) revert color picker to working version (CenterForOpenScience#9968) Instrument the ORCiD SSO affiliation flow * Existing user with verified ORCiD ID * Existing user confirmation of linking ORCiD ID * New user confirmation of account creation with ORCiD ID Add a django command script to handle instn sso email domain changes Bump version and CHANGELOG Add better logic for routing Dataverse files and their stupid duplicate (CenterForOpenScience#9963) [ENG-3872] Fix dataverse 502s and pass version info to FE (CenterForOpenScience#9959) Fix File `show_as_unviewed` behavior (CenterForOpenScience#9960) Fix OSFUser.has_resources ensure VOL users always get read perms (CenterForOpenScience#9952) make types correspond more to serializer code (CenterForOpenScience#9955) remove special casing from DV permissions (CenterForOpenScience#9947) Add a generic demo institution on the test server Don't send empty affiliations list to Datacite or Crossref Update pre-commit config to specify py version Fix DOI conditional Bump version and update CHANGELOG Update sc to use new SSO IdP ...
into update-README * 'develop' of https://github.com/CenterForOpenScience/osf.io: Only redirect to cas if not logged in OSFI: Update Shared SSO and Add MagLab/FSU [ENG-3654] [ENG-3898][ENG-3899]Model support for OutcomeArtifact update and delete (CenterForOpenScience#9989) Make OutcomeArtifact.identifier nullable (CenterForOpenScience#9986) [ENG-3894] Outcome models (CenterForOpenScience#9975) revert color picker to working version (CenterForOpenScience#9968) Instrument the ORCiD SSO affiliation flow * Existing user with verified ORCiD ID * Existing user confirmation of linking ORCiD ID * New user confirmation of account creation with ORCiD ID Add a django command script to handle instn sso email domain changes Bump version and CHANGELOG Add better logic for routing Dataverse files and their stupid duplicate (CenterForOpenScience#9963) [ENG-3872] Fix dataverse 502s and pass version info to FE (CenterForOpenScience#9959)
into remove-quickfiles-code * 'develop' of https://github.com/CenterForOpenScience/osf.io: (44 commits) Re-add non-anonymized fields removed in CenterForOpenScience#10009 (CenterForOpenScience#10022) Update shield logo for colorado (UC Boulder) Update description for maglab [ENG-3249] Improve registration anonymization (CenterForOpenScience#10009) "backport" artifact changes and swap schema_response.justification (CenterForOpenScience#10003) Add new instn purdue Ensure BitBucket token is string, not bytes Only redirect to cas if not logged in OSFI: Update Shared SSO and Add MagLab/FSU [ENG-3654] [ENG-3898][ENG-3899]Model support for OutcomeArtifact update and delete (CenterForOpenScience#9989) Make OutcomeArtifact.identifier nullable (CenterForOpenScience#9986) [ENG-3894] Outcome models (CenterForOpenScience#9975) revert color picker to working version (CenterForOpenScience#9968) Instrument the ORCiD SSO affiliation flow * Existing user with verified ORCiD ID * Existing user confirmation of linking ORCiD ID * New user confirmation of account creation with ORCiD ID Add a django command script to handle instn sso email domain changes Bump version and CHANGELOG Add better logic for routing Dataverse files and their stupid duplicate (CenterForOpenScience#9963) [ENG-3872] Fix dataverse 502s and pass version info to FE (CenterForOpenScience#9959) Fix File `show_as_unviewed` behavior (CenterForOpenScience#9960) Fix OSFUser.has_resources ... # Conflicts: # api_tests/files/views/test_file_detail.py # osf/models/nodelog.py # osf/models/user.py # tests/test_addons.py # website/static/js/anonymousLogActionsList.json # website/static/js/logActionsList.json
into remove-quickfiles-code * 'develop' of https://github.com/CenterForOpenScience/osf.io: (44 commits) Re-add non-anonymized fields removed in CenterForOpenScience#10009 (CenterForOpenScience#10022) Update shield logo for colorado (UC Boulder) Update description for maglab [ENG-3249] Improve registration anonymization (CenterForOpenScience#10009) "backport" artifact changes and swap schema_response.justification (CenterForOpenScience#10003) Add new instn purdue Ensure BitBucket token is string, not bytes Only redirect to cas if not logged in OSFI: Update Shared SSO and Add MagLab/FSU [ENG-3654] [ENG-3898][ENG-3899]Model support for OutcomeArtifact update and delete (CenterForOpenScience#9989) Make OutcomeArtifact.identifier nullable (CenterForOpenScience#9986) [ENG-3894] Outcome models (CenterForOpenScience#9975) revert color picker to working version (CenterForOpenScience#9968) Instrument the ORCiD SSO affiliation flow * Existing user with verified ORCiD ID * Existing user confirmation of linking ORCiD ID * New user confirmation of account creation with ORCiD ID Add a django command script to handle instn sso email domain changes Bump version and CHANGELOG Add better logic for routing Dataverse files and their stupid duplicate (CenterForOpenScience#9963) [ENG-3872] Fix dataverse 502s and pass version info to FE (CenterForOpenScience#9959) Fix File `show_as_unviewed` behavior (CenterForOpenScience#9960) Fix OSFUser.has_resources ... # Conflicts: # api_tests/files/views/test_file_detail.py # osf/models/nodelog.py # osf/models/user.py # tests/test_addons.py # website/static/js/anonymousLogActionsList.json # website/static/js/logActionsList.json
into remove-quickfiles-code * 'develop' of https://github.com/CenterForOpenScience/osf.io: (44 commits) Re-add non-anonymized fields removed in CenterForOpenScience#10009 (CenterForOpenScience#10022) Update shield logo for colorado (UC Boulder) Update description for maglab [ENG-3249] Improve registration anonymization (CenterForOpenScience#10009) "backport" artifact changes and swap schema_response.justification (CenterForOpenScience#10003) Add new instn purdue Ensure BitBucket token is string, not bytes Only redirect to cas if not logged in OSFI: Update Shared SSO and Add MagLab/FSU [ENG-3654] [ENG-3898][ENG-3899]Model support for OutcomeArtifact update and delete (CenterForOpenScience#9989) Make OutcomeArtifact.identifier nullable (CenterForOpenScience#9986) [ENG-3894] Outcome models (CenterForOpenScience#9975) revert color picker to working version (CenterForOpenScience#9968) Instrument the ORCiD SSO affiliation flow * Existing user with verified ORCiD ID * Existing user confirmation of linking ORCiD ID * New user confirmation of account creation with ORCiD ID Add a django command script to handle instn sso email domain changes Bump version and CHANGELOG Add better logic for routing Dataverse files and their stupid duplicate (CenterForOpenScience#9963) [ENG-3872] Fix dataverse 502s and pass version info to FE (CenterForOpenScience#9959) Fix File `show_as_unviewed` behavior (CenterForOpenScience#9960) Fix OSFUser.has_resources ... # Conflicts: # api_tests/files/views/test_file_detail.py # osf/models/nodelog.py # osf/models/user.py # tests/test_addons.py # website/static/js/anonymousLogActionsList.json # website/static/js/logActionsList.json
into remove-quickfiles-code * 'develop' of https://github.com/CenterForOpenScience/osf.io: (44 commits) Re-add non-anonymized fields removed in CenterForOpenScience#10009 (CenterForOpenScience#10022) Update shield logo for colorado (UC Boulder) Update description for maglab [ENG-3249] Improve registration anonymization (CenterForOpenScience#10009) "backport" artifact changes and swap schema_response.justification (CenterForOpenScience#10003) Add new instn purdue Ensure BitBucket token is string, not bytes Only redirect to cas if not logged in OSFI: Update Shared SSO and Add MagLab/FSU [ENG-3654] [ENG-3898][ENG-3899]Model support for OutcomeArtifact update and delete (CenterForOpenScience#9989) Make OutcomeArtifact.identifier nullable (CenterForOpenScience#9986) [ENG-3894] Outcome models (CenterForOpenScience#9975) revert color picker to working version (CenterForOpenScience#9968) Instrument the ORCiD SSO affiliation flow * Existing user with verified ORCiD ID * Existing user confirmation of linking ORCiD ID * New user confirmation of account creation with ORCiD ID Add a django command script to handle instn sso email domain changes Bump version and CHANGELOG Add better logic for routing Dataverse files and their stupid duplicate (CenterForOpenScience#9963) [ENG-3872] Fix dataverse 502s and pass version info to FE (CenterForOpenScience#9959) Fix File `show_as_unviewed` behavior (CenterForOpenScience#9960) Fix OSFUser.has_resources ... # Conflicts: # api_tests/files/views/test_file_detail.py # osf/models/nodelog.py # osf/models/user.py # tests/test_addons.py # website/static/js/anonymousLogActionsList.json # website/static/js/logActionsList.json
Purpose
Currently Dataverse/WB send two versions of datverse files with the same path to osf.io, this is problematic because our FE/API can't distinguish which file to retrieve when asked to list files at that path. This PR adds a special case for dataverse so both files are listed at that path and passes the versioning infomation to the FE so they can style the files accordingly.
This also removes an used branch of code by changing the logic of the
infoqueryset retrieval code. Those are the changes inapi/nodes/views.py.Changes
MultipleObjectsReturnedcase for dataverse onlyextraversion info to FEQA Notes
Please make verification statements inspired by your code and what your code touches.
What are the areas of risk?
Any concerns/considerations/questions that development raised?
Documentation
Side Effects
Ticket
https://openscience.atlassian.net/browse/ENG-3872