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

[ENG-6813] FE PR for Preprints DOI Versioning #2447

Merged
merged 24 commits into from
Jan 27, 2025

Conversation

cslzchen
Copy link
Collaborator

@cslzchen cslzchen commented Jan 1, 2025

Purpose

  • Enable Preprint DOI Versioning on the FE

Summary of Changes

  • Add new version workflow
  • Update preprint edit workflow
  • Move preprint withdrawal button out of the edit workflow
  • Add version selection controls
  • Update models/mirage/etc

Screenshot(s)

N/A

Side Effects

N/A

QA Notes

N/A

-   Ticket: [ENG-6447]
-   Feature flag: n/a

## Purpose
- Update the Preprint model to add new version-specific fields

## Summary of Changes
- Add new `preprintVersion` and `isLatestVersion` attrs to Preprint
- Add new `versions` relationship to Preprint
  - This won't be returned from the API, but the preprint response should have a `preprint_version` URL that can be used to get versions, hence the chicanery with the preprint-serializer
- Add new mirage view to handle fetching versions
- Add new trait to preprint factory to quickly create versions for a given preprint
-   Ticket: [ENG-6448]
-   Feature flag: n/a

## Purpose
- Update preprint-doi component to handle versions

## Summary of Changes
- Update Preprints::PreprintDoi component 
  - Takes an array of versions, rather than a single preprint
  - Add dropdown to select a specific version
  - Tests
)

-   Ticket: [ENG-6434]
-   Feature flag: n/a

## Purpose
- Add logic to show/hide the file upload step on the preprint submission/edit workflow

## Summary of Changes
- Add a new flag `displayFileUploadStep` that controls whether or not the file upload step is shown
  - Should be shown for initial preprint submission
  - Should be shown for rejected preprint re-submission
…#2423)

-   Ticket: [ENG-6459] [ENG-6637] [ENG-6638]
-   Feature flag: n/a

## Purpose
- Add a new "Create new version" button to the preprint detail page

## Summary of Changes
- Add a new `canCreateNewVersion` attr to preprint model
  - Only admins can create a new version
  - Only preprints that is the latest version can create a new version
  - Only preprints that are were published at some point (whether they are withdrawn or not, doesn't matter)
- Update tombstone page for preprint versions
-   Ticket: [ENG-6460] [ENG-6640]
-   Feature flag: n/a

## Purpose
- Add a new workflow to create a new preprint version

## Summary of Changes
- Add a new `preprint.new-version` route
- Add a new `newVersion` argument to the submission-flow component
  - Invoke `submission-flow` component in the new-version route
-   Ticket: [ENG-6470]
-   Feature flag: n/a

## Purpose
- Add a version select dropdown to the tombstone page

## Summary of Changes
- Add dropdown to tombstone page header to view prior versions
- Update tests
@coveralls
Copy link

coveralls commented Jan 1, 2025

Pull Request Test Coverage Report for Build 12916217179

Details

  • 245 of 308 (79.55%) changed or added relevant lines in 14 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+3.5%) to 68.015%

Changes Missing Coverage Covered Lines Changed/Added Lines %
app/preprints/-components/withdrawal-preprint/component.ts 4 5 80.0%
app/preprints/new-version/controller.ts 0 1 0.0%
app/preprints/-components/preprint-status-banner/component.ts 12 15 80.0%
app/preprints/new-version/route.ts 9 13 69.23%
app/preprints/detail/route.ts 17 23 73.91%
app/preprints/detail/controller.ts 21 39 53.85%
app/preprints/-components/submit/preprint-state-machine/component.ts 58 88 65.91%
Totals Coverage Status
Change from base Build 12895413643: 3.5%
Covered Lines: 7474
Relevant Lines: 10613

💛 - Coveralls

@cslzchen cslzchen changed the title [ENG-6812] FE Reference PR for Preprints DOI Versioning [ENG-6813] FE Reference PR for Preprints DOI Versioning Jan 1, 2025
futa-ikeda and others added 11 commits January 2, 2025 09:29
-   Ticket: [ENG-6471]
-   Feature flag: n/a

## Purpose
- Add version statuses for pending, rejected, and withdrawn versions

## Summary of Changes
- Add version status to Version DOI selector
- Add version status to Withdrawn page's version selector dropdown
-   Ticket: [ENG-6803]
-   Feature flag: n/a

## Purpose
- Indicate currently viewed version in the preprint DOI selection dropdown

## Summary of Changes
- Add a `currentVersion` param to the preprint-doi component
  - Have this version be the selected one by default
  - Add bold font style to current version
-   Ticket: [ENG-6804]
-   Feature flag: n/a

## Purpose
- Add a link to the version when selecting a different version in the DOI selection dropdown

## Summary of Changes
- Add link to preprint DOI dropdown
- Update tests
-   Ticket: [ENG-6814]
-   Feature flag: n/a

## Purpose
- Show helpful toast message if the request to create a new version returns a 409 error

## Summary of Changes
- Fix logic for how to display toast error
- Update template so the "Create new version" button is disabled when the task is running
- Update page-not-found reroute logic to be more robust
-   Ticket: [ENG-6815] [ENG-6843]
-   Feature flag: n/a

## Purpose
- Fix issues of "Edit" and "Edit and Resubmit" button showing up at inappropriate preprint states

## Summary of Changes
- Update condition to show Edit button
  - Only read-write and admin contributors should be able to edit
  - Only latest version should be editable
  - Non-initial, rejected (pre-mod) versions should not be editable
-   Ticket: [ENG-6822] [ENG-6871]
-   Feature flag: n/a

## Purpose
- Fix an issue where the preprint status banner doesn't update when selecting a different version

## Summary of Changes
- Refactor status banner component to use arguments instead of a cached arg reference
-   Ticket: [ENG-6461] [ENG-6462]
-   Feature flag: n/a

## Purpose
- Move "Withdraw" button out of the edit workflow and onto preprint detail page

## Summary of Changes
- Move the "Withdraw" button out of the `ActionFlow` component and onto the detail page
  - Move logic for fetching preprint/withdraw-request state out of the `ActionFlow` component and into route's `model` hook
  - Move `onWithdrawal` callback to detail controller
  - Refactor `withdraw-preprint` component to take multiple arguments instead of relying on a manager component
-   Ticket: [ENG-6931]
-   Feature flag: n/a

## Purpose
- Update the file version shown in mfr window when changing preprint versions

## Summary of Changes
- Don't use cached preprint or file-version in file renderer component
-   Ticket: [ENG-6950](https://openscience.atlassian.net/browse/ENG-6950)
-   Feature flag: n/a

## Purpose
- Add versioning language to withdraw modal

## Summary of Changes
- Add new translation
@futa-ikeda futa-ikeda marked this pull request as ready for review January 17, 2025 19:39
futa-ikeda and others added 3 commits January 17, 2025 17:03
…2482)

-   Ticket: []
-   Feature flag: n/a

## Purpose
- Fix bug which prevented users from seeing moderator feedback

## Summary of Changes
- Decouple fetching the latest review-action to preprint-state
- Allow all preprint contributors to see moderator feedback
…nt requests (#2485)

* Reimplement bug fix, but this time better (maybe)

* Fix status banner modal bug
brianjgeiger
brianjgeiger previously approved these changes Jan 21, 2025
Copy link
Contributor

@brianjgeiger brianjgeiger left a comment

Choose a reason for hiding this comment

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

A couple of minor things, including some commented-out code with a TODO and some potentially unused services, plus one post-release BE change that would affect the FE.

app/preprints/new-version/route.ts Outdated Show resolved Hide resolved
app/preprints/-components/preprint-doi/component.ts Outdated Show resolved Hide resolved
app/preprints/new-version/route.ts Outdated Show resolved Hide resolved
import OsfSerializer from './osf-serializer';

export default class PreprintSerializer extends OsfSerializer {
normalize(modelClass: Model, resourceHash: Resource) {
const result = super.normalize(modelClass, resourceHash);
// Insert a `versions` relationship to the model
Copy link
Contributor

Choose a reason for hiding this comment

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

I did not realize we weren't serializing this on the back end. Ick. Not blocking, but I'm not super-happy about it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yea, I recall there was some oddity (potential self-reference/recursiveness) that prevented us from serializing it in the backend?

@brianjgeiger
Copy link
Contributor

And it looks like we want to merge develop into here at some point soon.

@futa-ikeda futa-ikeda added this to the 25.03.0 milestone Jan 22, 2025
@futa-ikeda futa-ikeda changed the title [ENG-6813] FE Reference PR for Preprints DOI Versioning [ENG-6813] FE PR for Preprints DOI Versioning Jan 27, 2025
@futa-ikeda futa-ikeda merged commit b4084d0 into develop Jan 27, 2025
10 checks passed
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