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

[IN-57][Reviews] Do not show warning on decision submit #112

Merged

Conversation

fabmiz
Copy link
Member

@fabmiz fabmiz commented Jan 30, 2018

Purpose

This is a follow-up PR for #108

Fix issue where the user gets a warning modal even after they submit
the decision form.

Summary of Changes

  • Set userHasEnteredReview to false on submitDecision action, hence preventing
    the showWarning to be set to true in willTransition action.
  • Updated tests

Side Effects / Testing Notes

On the preprint detail page:

  • Change the reviewer's decision
  • Without submitting the form, attempt to click on any link on the page; make sure you are prevented from navigating forward and shown the warning modal. On the modal, hit stay or leave and see if they behave as expected.
  • Back to the preprint detail page, modify decision, and submit. You should not get the warning modal.

Ticket

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

Reviewer Checklist

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

@coveralls
Copy link

coveralls commented Jan 30, 2018

Coverage Status

Coverage decreased (-1.4%) to 49.825% when pulling d073763 on fabmiz:feature/IN-57_fix_warning into 4275cb0 on CenterForOpenScience:develop.

Copy link
Contributor

@sheriefvt sheriefvt left a comment

Choose a reason for hiding this comment

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

looks good to me

@@ -124,6 +124,7 @@ export default Controller.extend({
},
submitDecision(trigger, comment, filter) {
this.toggleProperty('savingAction');
this.set('userHasEnteredReview', false);

Choose a reason for hiding this comment

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

ember-onbeforeunload has a function that you can call in the router called shouldCheckIsPageDirty, where you can exclude certain routes from the isPageDirty check. In normal preprints, we have the submit route/button exempt from the warning modal on click.

Would it be a better practice to use shouldCheckIsPageDirty here too instead of changing userHasEnteredReview in the controller?

@alexschiller
Copy link
Contributor

@fabmiz See Baylee's comment. Worth exploring as an option, kicking back to AD while you investigate.

Copy link

@baylee-d baylee-d left a comment

Choose a reason for hiding this comment

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

LGTM. Nice way to use the shouldCheckIsPageDirty function!

Copy link
Contributor

@alexschiller alexschiller left a comment

Choose a reason for hiding this comment

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

LGTM 🥇

@alexschiller alexschiller merged commit fa07a26 into CenterForOpenScience:develop Feb 20, 2018
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.

None yet

5 participants