-
Notifications
You must be signed in to change notification settings - Fork 344
[ENG-7716] Allow for reinstatement of previous preprint versions (with date uploaded) via the admin app #11097
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
[ENG-7716] Allow for reinstatement of previous preprint versions (with date uploaded) via the admin app #11097
Conversation
Alternatives:
Both requires additional actions from user, but will make this PR ~2x smaller |
@antkryt Looks like there's a failed test.
|
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.
Why are you going through the API for this instead of just using the Preprint model to make the changes? It seems as though it would save you a lot of trouble if you just made the changes directly via the model. The Admin app shouldn't interact with the API.
The Preprint.create_version documentation states: If I don't use the serializer, I would need to manually call around 15 Preprint.set_ methods, each with ignore-permission=True. Also, if the data_to_update dictionary structure or PreprintCreateVersionSerializer.update logic ever changes in the future, it may easily break this feature. So, nothing really changes if I use PreprintCreateVersionSerializer (API) or not because of the create_version() function |
I see. |
c3a002d
to
00a81b0
Compare
90d5b68
into
CenterForOpenScience:feature/pbs-25-08
…cience/osf.io into impact-notifications * 'feature/pbs-25-08' of https://github.com/CenterForOpenScience/osf.io: (28 commits) [ENG-7716] Allow for reinstatement of previous preprint versions (with date uploaded) via the admin app (CenterForOpenScience#11118) [ENG-7263] Fix/eng 7263 part 3 (CenterForOpenScience#11119) [ENG-7263] Part 2 (CenterForOpenScience#11110) fix feature for non-contributor admin (CenterForOpenScience#11111) [ENG-7716] Allow for reinstatement of previous preprint versions (with date uploaded) via the admin app (CenterForOpenScience#11097) delete sharev2 push [ENG-7387] (CenterForOpenScience#11032) [ENG-7503] Fix/eng 7503 (CenterForOpenScience#11092) [ENG-7263] Fix/eng 7263 (CenterForOpenScience#11090) [ENG-7798] Parse versioned guid (CenterForOpenScience#11104) [ENG-7270] Enable Product Team to Force Archive Registrations in the Admin App (CenterForOpenScience#11105) gdpr deletion shouldn't take into account deleted nodes (CenterForOpenScience#11098) Bind task for proper retrying improved naming use newly built doi for previous versions mint missing doi when build metadata use minted doi for building metadata updated error text simplified query flat guids added version filtering ... # Conflicts: # api/crossref/views.py # tests/test_events.py # tests/test_misc_views.py
…h date uploaded) via the admin app (CenterForOpenScience#11097) ## Purpose Add "Create new version 1" button on admin UI ## Changes - Add button to admin UI - Extend existing preprint versioning functionality - Move permission validation logic from serializer to model level to keep everything in one place - add required_permission decorator (with ignore_permission functionality) that checks if user has enough permission to call method ## QA Notes Expected behavior: 1. Admin goes the preprint admin page 2. Clicks "Create new version 1", a modal asking to choose date will be displayed 3. If date is valid and file versions exists: - a new version 1 will be created - admin user will be redirected to v1 - optionally, admin user can make new preprint published by clicking "Make published" button (!) Preprint guid should point to the latest version, not the newly created one. (!) Admin should be able to create new versions of a preprint even if they are not a contributor. ## Ticket https://openscience.atlassian.net/browse/ENG-7716
…h date uploaded) via the admin app (CenterForOpenScience#11097) ## Purpose Add "Create new version 1" button on admin UI ## Changes - Add button to admin UI - Extend existing preprint versioning functionality - Move permission validation logic from serializer to model level to keep everything in one place - add required_permission decorator (with ignore_permission functionality) that checks if user has enough permission to call method ## QA Notes Expected behavior: 1. Admin goes the preprint admin page 2. Clicks "Create new version 1", a modal asking to choose date will be displayed 3. If date is valid and file versions exists: - a new version 1 will be created - admin user will be redirected to v1 - optionally, admin user can make new preprint published by clicking "Make published" button (!) Preprint guid should point to the latest version, not the newly created one. (!) Admin should be able to create new versions of a preprint even if they are not a contributor. ## Ticket https://openscience.atlassian.net/browse/ENG-7716
Purpose
Add "Create new version 1" button on admin UI
Changes
Screencast.from.2025-04-22.14-43-05.webm
QA Notes
Expected behavior:
(!) Preprint guid should point to the latest version, not the newly created one.
(!) Admin should be able to create new versions of a preprint even if they are not a contributor.
Documentation
Side Effects
Ticket
https://openscience.atlassian.net/browse/ENG-7716