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

[Need QA Prep] Feature/Divorce Front End [ember-osf-preprints] [IN-98] #626

Merged

Conversation

pattisdr
Copy link
Contributor

@pattisdr pattisdr commented Sep 23, 2018

Related Links

Back End
Ember-OSF
Front End

Demo Round One
Demo Round Two

TODO List

Purpose

This PR attempts to make the minimum number of changes necessary to get in the backend divorce code. The backend required a huge overhaul, so keeping the front-end changes as small as possible will help with testing. We still save by section, but nodes are no longer edited on the preprint form.

Summary of Changes/Side Effects

  • No updates made to node. All fields are stored on the preprint.
  • "upload" choices reduced. You can either create a new preprint, or copy a file from a project to create your preprint.
  • All contributors can access the "Edit" form. Write contribs can make a considerable amount of edits now, aside from modifying contributors, resubmitting the preprint, etc. Write/read can remove themselves as contributors.
  • You can attach a node as a supplementary project.
  • Preprint detail page has removed supplemental files browser. Supplemental project is linked at the top by authors.

Testing Notes

Thorough testing of creating a preprint, editing a preprint, and viewing a preprint needed. Even if behavior appears the same in places, where the code is getting called has often been rearranged, so we need to make sure we're seeing what is expected. Extra attention should be paid to "File" sections and "Supplemental materials" and "Authors"

  • General notes: Verify behavior on osf preprints as well as multiple providers (a pre and post moderation provider). Preprints should be created prior to the data migration for this, with preprints in different states - private preprints, preprints with file removed, preprints with project deleted, abandoned preprints, A-OK preprints...Verify that post-migration, you can see everything you expect to see. The original project for those preprints is now their supplemental project.

File Section

Upload from your computer

  • Uploading a file and adding a title should:
  1. Create a preprint with the added title and provider
  2. Upload file to created preprint
  3. Update the preprint with the newly updated file as the primary file
  • Verify "Back" button returns you to initial file choice and clears pre-uploaded file and title
  • Verify save button turns green when "Save and continue" is finished
  • Verify "Save and continue" button is disabled while file is saving
  • If part of the request series fails, and you attempt to hit "Save and continue" again, the requests should work and you should proceed to the next form section.
    • If file successfully uploaded, but not set as primary file, when you attempt to resave, file upload request not reattempted, as long as the file has stayed the same. Instead, we fetch the already uploaded file (prevents 409's).
  • Verify that no nodes were created when you hit "Save and continue"

Select from existing project

  • Choices in this section are reduced. There used to be four combinations of choices possible, now you only have one - to pick a file from an existing project that will be copied to your preprint. You pick a project, then pick a file, then add a title.
  • Projects that appear in dropdown are public projects and components that you have admin permissions to. It no longer matters if that project has been linked to multiple preprints. A project can now be the supplemental project for multiple preprints. The one preprint per provider per node constraint has been removed.
  • Verify that when you select your project, file picker automatically opened for you.
  • Verify that when you select your file, title section automatically opened for you, and it is pre-populated with the node's title.
  • Verify changing your project updates the file picker and removes the title section.
  • Verify changing your file does not change your already added title.
  • Verify hitting "Back" resets the project picker
  • Verify that you can't hit "Save and continue" without a title
  • Verify title length has increased to 512 characters
  • Hitting "save and continue" should:
  1. Create the preprint with the given title and provider
  2. Send a WB request to the node which copies that node's file to the preprint
  3. Updates the preprint with the node's description and tags and sets the newly copied file as the primary file on your preprint. You can edit the description and tags later.
  4. All of the node's contributors are copied to the preprint. If the request fails, this is ignored.
  • Verify "Save and continue" disabled while all these requests are occurring
  • Verify that no nodes were created when hitting "Save and continue"
  • Preprint file uploaded! toast message on success

Updating file version or title

  • Verify when you click on "File" section after file has been uploaded, the nested "Preprint File" and "Preprint Title" sections are collapsed.
  • Verify editing the title only sends a request to update the title
  • Verify that updating the file with a file of a different name fails with a "This is not a version of the current preprint file" or similar toast message
  • Verify behavior when uploading a new version (that hasn't actually changed). Uploading a version 2 will say Version 2 in preview. Upon "Save and continue", after attempting to update WB, it will realize the file hasn't actually changed and revert back to Version 1 in the preview.
  • Staged (unsaved) edits to a primary file or title will turn the save button red.
  • A save will automatically advance to the next section
  • Verify "write" contributors can now edit all parts of this section on Edit Preprint page

Basics section

  • Section has swapped places with discipline.
  • Verify that if you chose an existing file from a project, the original node's description and tags have been copied into the form. If you uploaded a new preprint file, the fields are blank.
  • Hitting "Save and continue" updates the preprint with license information, tags, description, original publication date, and doi if these items were updated.
  • Verified no node requests are made, just preprint.
  • Verify discard changes resets the basics section to the last saved state
  • Verify only saved changes show up in Basics preview
  • Verify unsaved changes in description, tags, doi, license, or original pub date turn the save button red. Manually undoing the changes or hitting "discard" resets the save button to green.
  • Bug fix, changing original pub date, then changing back to already saved date turns save button green. savedstate recognizes that date is the same.
  • Verify bug fix, after you've saved an original publication date, you can then clear it and save (use case, original publication date saved in error)
  • Hitting the "save" button turns the save button green and advances to the discipline section
  • Verify "write" contributors can now edit all parts of this section on Edit Preprint page

Discipline Section

  • Barely any changes made to this section - Discipline section only swapped places with basics section
  • Verify "write" contributors can now edit all parts of this section on Edit Preprint page
  • Verify that saving discipline section advances to the authors section
  • Verify a request is made to the update the preprint
  • Verify unsaved changes turn the save button red, that 'discard changes' reverts to the last save state, and 'save and continue' saves changes and turns the save button green
  • Verify manually setting the disciplines back to the last save state turns the save button green

Authors section

  • Verify that if you copied a preprint file from an existing node, that node's contributors have been copied to the preprint. If you uploaded a new preprint file, you should see only one contributor, yourself.
  • Verify that any edits to contributors are making changes to preprint contributors, no requests are being made to the node.
  • Verify that the creator of the preprint cannot remove themselves on the Submit page, but can remove themselves on the Edit page, provided contributor rules are adhered to (at least one other admin contrib/bibliographic contrib)
  • Verify that if you remove yourself as an author, you are automatically redirected to the Preprints Index page, with a toast message saying you've removed yourself
  • Verify that if an admin contributor downgrades their own permissions from "Admin" -> "Write", the UI instantly disables their contributor options, to only being able to remove themselves.
  • Verify that if an admin contributor downgrades their own perms from "Admin" -> "Read" on Edit, the UI instantly disables their contributor options, and all form sections but Authors are removed. Their only option is to now remove themselves as author, as they are only a Read author.
  • Verify that Write contributors and Edit contributors can remove themselves only. This is the only edit they can make to the authors section. Anything else they try to click on is disabled.
  • Verify that Read contributors only see the authors section on Edit, and that the Authors section is automatically opened for them.
  • Verify UI always prevents author rules from being broken. If you only have one bibliographic contributor left, you cannot remove it, or remove their bibliographic status. If you only have one admin contributor left, you cannot remove them, or downgrade their permissions. These form options will be disabled.
  • Verify searching for authors works
  • Verify adding contributors works (on Submit, no email is sent). They are given write perms and bibliographic = True by default
  • Verify changing permission/bibliographic updates preprint contributor and request is sent immediately
  • Verify removing preprint contributor deletes preprint contributor immediately
  • Verify adding unregistered author works
  • Verify continue button advances to next form section
  • Verify reordering contributors works as expected

Supplemental Materials section

Submit

Connecting an existing project
  • Verify that Supplemental Materials(optional) section starts with no project connected
  • Verify clicking on "Connect an existing OSF Project" opens to the project picker
  • Verify selecting a project turns the "Save" button red
  • Verify hitting "Back" clears the project
  • Verify hitting "Save and continue" turns the save button green, and locally stages that project as the connected project. The form preview will say "Connected OSF Project", but we won't actually send a request to connect this until "Submit preprint" is clicked.
  • Verify hitting "Back" after the selected project has been locally staged does not clear the project
  • Verify you can't click save and continue without project being selected
  • Verify hitting "Skip" clears the project.
  • Verify hitting "Submit preprint" sends a request to turn the selected project public if it wasn't already and sets the project as the supplemental project on the preprint
Create a new OSF Project
  • Verify clicking "Create a new OSF project" opens to a title editor with "Supplemental materials for + autopopulated
  • Verify you can't click save and continue without title being populated
  • Verify "Back" clears the title
  • Verify "Save and continue" locally stages that title - You will see Connected OSF Project: . However we don't actually send the request to create the project until "Submit preprint" is clicked. This is to prevent a bunch of extra projects inadvertently being created as the user changes their mind
  • Verify hitting back after save does not remove the staged title.
  • Verify hitting "Skip" removes the staged title.
  • Verify hitting "Submit Preprint" sends a request to create a new public OSF project with the title you specified. This newly created project is set as your supplemental project.

Supplemental Materials - EDIT

  • Verify both admin/write can edit
  • If supplemental project is connected, and you are on the Edit preprint page, you either have an option to "Change the connected project" or "Disconnect the project"
  • Verify "Skip" closes the form section and discards any unsaved changes. If project was previously connected, this project should remain connected
  • Clicking "Change the connected project" gives you the same Supplemental materials options you had on Submit: "Connect an existing OSF project" or "Create a new OSF project". The "Back" button moves you back to your first option: Change or Disconnect.
  • Verify selecting a project from the dropdown that is already connected shows the green save button because saving won't actually do anything.
  • If you connect an existing project and click "Save and continue", your changes are saved immediately, unlike Submit. The project is turned public, if it wasn't already.
  • If you connect a new project, and click "Save and continue", a public project is created immediately and saved as your supplemental project. Title was autopopulated for you on the first time the section was opened, but you can edit.
  • When connecting a new project, if you enter in an identical title to the already connected supplemental project, the save button is red, because you are intending to create a new project.
  • Clicking "Disconnect" immediately sends a PATCH request to remove the project from your preprint. You get a toast message confirming it was removed and the form section is closed. If you reopen the supplemental section, you go straight to your "Connect an existing" or "Create new project" options. You don't see the "Change or Disconnect" optinos because no project is connected.
  • If the supplemental project has been made private, and I don't have permissions to that project, the preview section says "Private supplemental project"

Submitting your preprint - Edit section

  • If pre-moderation and preprint is rejected, write contributors should see a message that they have to be an admin to resubmit
  • Write/read can only return to preprint
  • Where applicable, admin only have the option to resubmit preprint

Preprint Detail Page

  • Verify supplemental project is linked at the top, if one exists
  • Verify if no supplemental project, or supplemental project has been turned private, there is no link
  • Verify that if preprint is private (spam preprints or legacy preprints, usually), a red banner shows that they need to contact support
  • If preprint uses pre-moderation or post-moderation and preprint is also private, only private banner is shown, not reviews banner
  • Verify supplemental files browser is gone from beneath the preprint.
  • Verify you can still download the preprint from the top right button
  • Verify preprint download button is removed from below the preprint
  • Verify you can still download preprint versions and the downloaded files are what you expect
  • Verify toggling to make preprint full screen still works and no javascript errors in console
  • Verify "Edit preprint" button now shows for all preprint authors, not just admin. Non-authors, unauthenticated still can't see this button.
  • Verify preprints can only be viewed by non-authors if they are published and public. Preprints that were abandoned halfway through, preprints that have been made private, preprints whose files have been deleted (still possible w/ legacy preprints), preprints w/ pre-moderation that are still pending, or pre-mod/post-mod that have been rejected....verify that they are not visible! You will see a Not Found page.
  • Verify that a private supplemental project that the logged-in user does not have permission to see does not affect the preprint itself from loading
  • Cannot manually navigate to "Edit" if you are not a contributor on the preprint
  • Verify "can comment" behavior works as before

Ticket

https://openscience.atlassian.net/browse/IN-98

Notes for Reviewer

Reviewer Checklist

  • meets requirements
  • easy to understand
  • DRY
  • testable and includes test(s)
  • changes described in CHANGELOG.md

- File upload uploads file to preprint, not node.
- Picking an existing project copies the file to the preprint
- Revising the upload section after it has been locked allows you to upload a new version to the preprint or update the preprint's title.
- Modifications to preprint contributors send requests to preprints not nodes.
- Use @laurenbarker's formatting on preprint detail page for created/modified/supplemental files.
- Load preprint contributors on edit page.
- Remove language that warns about information being updated on your project.
-
…r and remove file-renderer component to content page.
…where file was successfully uploaded to preprint, but subsequent preprint requests failed.

- Fixes for errors where preprint title update fails.
- No need to have the file-uploader component used within preprint-form-project-select anymore.
- Can stop passing in all of these properties into preprint-form-project-select
- Add manual toggling for file version update section
- No need to track existingstate anymore - file picker state is sufficient
…ere preprint file was copied) to Preprint.

- If contributor copy fails, this is ignored (not critical that all contributors copied).
- Description/tags automatically added to preprint on creation. Can be edited later in the form.
- Preprint title auto-filled, but can be edited before creation.
- Pull supplemental document type from translations.
- Remove unused location_of_preprint
- Add corrections to validations of supplemental materials section, and indicator of whether supplemental section has changed
- Add better error handling and metrics to supplemental section
…e preprint. You still must be an admin contributor to edit contributors. Allow all contributors to remove themselves.
…entary-file-browser. Only renders the primaryFile and allows downloading of its versions.
@pattisdr pattisdr changed the title [WIP] Feature/Divorce Front End [IN-98] [WIP] Feature/Divorce Front End [Ember-osf-preprints] [IN-98] Sep 23, 2018
@pattisdr pattisdr changed the title [WIP] Feature/Divorce Front End [Ember-osf-preprints] [IN-98] [WIP] Feature/Divorce Front End [ember-osf-preprints] [IN-98] Sep 24, 2018
@alexschiller alexschiller changed the base branch from develop to feature/node-preprint-divorce October 19, 2018 18:04
@alexschiller alexschiller changed the base branch from feature/node-preprint-divorce to develop October 19, 2018 18:05
…de-preprint-divorce

Fix/Divorce - Rendering of Preprint File [IN-98]
@pattisdr pattisdr changed the title [Ready for Review][Need QA Prep] Feature/Divorce Front End [ember-osf-preprints] [IN-98] [Need QA Prep] Feature/Divorce Front End [ember-osf-preprints] [IN-98] Oct 24, 2018
…er-osf-preprints into feature/divorce_front_end

# Conflicts:
#	package.json
#	yarn.lock
@pattisdr
Copy link
Contributor Author

@jamescdavis, it looked to me like the only issues bringing this branch up-to-date with develop was the package.json and yarn.lock files that Alex had updated. He had pointed them towards the NPD ember-osf commits - so this will need to be done when this is released.

@jamescdavis
Copy link
Member

@pattisdr, no problem, I'll take care of that during release. Thanks for updating!

… Remove Author modal background lighter, but not necessary.)

- This was making popover opacity too transparent. PLAT-1224
…er-osf-preprints into feature/divorce_front_end

# Conflicts:
#	app/routes/content/index.js
@@ -252,7 +252,7 @@
<button class="btn btn-block btn-big" {{action 'changeConnectedProject'}}>{{t "submit.body.supplemental_change_saved"}}</button>
</div>
<div class="col-xs-6">
<button class="btn btn-block btn-big btn-big-danger" {{action 'removeSupplementalNode'}}>{{t "submit.body.disconnect_supplemental"}}</button>
<button class="btn btn-block btn-big" {{action 'removeSupplementalNode'}}>{{t "submit.body.disconnect_supplemental"}}</button>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

screen shot 2018-11-19 at 5 47 25 pm

<i class="fa fa-times"> </i>
</button>
{{#if (and (permission-to-remove-contributor contrib currentUser isAdmin editMode) (conditions-for-contrib-removal contrib contributors authorModification))}}
{{#if (contributor-is-current-user contrib currentUser)}}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

screen shot 2018-11-19 at 3 13 57 pm

.fade.in {
background: rgba(0, 0, 0, 0.08);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

screen shot 2018-11-19 at 3 57 33 pm

@pattisdr
Copy link
Contributor Author

@jamescdavis, can you get this latest commits onto staging3?

@pattisdr
Copy link
Contributor Author

pattisdr commented Nov 26, 2018

@jamescdavis, working now to get NPD up-to-date with the metatags hotfix

EDIT: up-to-date now

if (searchResults && searchResults.meta !== undefined) {
return searchResults.meta.total_pages;
}
}),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

screen shot 2018-11-28 at 8 51 23 am

Copy link
Contributor Author

Choose a reason for hiding this comment

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

restores pagination

Copy link
Member

@jamescdavis jamescdavis left a comment

Choose a reason for hiding this comment

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

Let's do this!

@jamescdavis jamescdavis merged commit 5034b88 into CenterForOpenScience:develop Nov 28, 2018
@pattisdr
Copy link
Contributor Author

yesssss

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.

5 participants