Skip to content
Snippets Groups Projects
Commit 25c6474b authored by Anca Ursachi's avatar Anca Ursachi
Browse files

fix(submissionWizard): Adding '/submit' in the manuscript link should not...

fix(submissionWizard): Adding '/submit' in the manuscript link should not allow users to edit it, ju
parent 07f92e45
No related branches found
No related tags found
3 merge requests!233S26 updates,!230S26 Updates,!225fix(submissionWizard): Adding '/submit' in the manuscript link should not allow users to edit it.
...@@ -9,7 +9,11 @@ import { DragDropContext } from 'react-dnd' ...@@ -9,7 +9,11 @@ import { DragDropContext } from 'react-dnd'
import styled, { css } from 'styled-components' import styled, { css } from 'styled-components'
import HTML5Backend from 'react-dnd-html5-backend' import HTML5Backend from 'react-dnd-html5-backend'
import { Button, Spinner, Steps } from '@pubsweet/ui' import { Button, Spinner, Steps } from '@pubsweet/ui'
import { selectCollection, selectFragment } from 'xpub-selectors' import {
selectFragment,
selectCollection,
selectCurrentUser,
} from 'xpub-selectors'
import { Redirect } from 'react-router' import { Redirect } from 'react-router'
import { import {
compose, compose,
...@@ -51,7 +55,6 @@ import { onChange, onSubmit, setInitialValues, validate } from './utils' ...@@ -51,7 +55,6 @@ import { onChange, onSubmit, setInitialValues, validate } from './utils'
const Wizard = ({ const Wizard = ({
step, step,
history, history,
canEdit,
journal, journal,
prevStep, prevStep,
isEditMode, isEditMode,
...@@ -60,11 +63,12 @@ const Wizard = ({ ...@@ -60,11 +63,12 @@ const Wizard = ({
handleSubmit, handleSubmit,
getButtonText, getButtonText,
isFilesFetching, isFilesFetching,
canEditManuscript,
isAuthorsFetching, isAuthorsFetching,
journal: { manuscriptTypes = [] }, journal: { manuscriptTypes = [] },
...rest ...rest
}) => }) =>
canEdit ? ( canEditManuscript ? (
<Root className="wizard-root"> <Root className="wizard-root">
<Steps currentStep={step}> <Steps currentStep={step}>
{wizardSteps.map(({ stepTitle }) => ( {wizardSteps.map(({ stepTitle }) => (
...@@ -130,6 +134,7 @@ export default compose( ...@@ -130,6 +134,7 @@ export default compose(
formValues: getFormValues('submission')(state), formValues: getFormValues('submission')(state),
submitFailed: hasSubmitFailed('submission')(state), submitFailed: hasSubmitFailed('submission')(state),
formSyncErrors: getFormSyncErrors('submission')(state), formSyncErrors: getFormSyncErrors('submission')(state),
isAdmin: get(selectCurrentUser(state), 'admin', false),
fragment: selectFragment(state, get(match, 'params.version')), fragment: selectFragment(state, get(match, 'params.version')),
collection: selectCollection(state, get(match, 'params.project')), collection: selectCollection(state, get(match, 'params.project')),
isAuthorsFetching: getAuthorFetching(state) || getAutosaveFetching(state), isAuthorsFetching: getAuthorFetching(state) || getAutosaveFetching(state),
...@@ -183,9 +188,11 @@ export default compose( ...@@ -183,9 +188,11 @@ export default compose(
status: get(collection, 'status', ''), status: get(collection, 'status', ''),
}), }),
), ),
withProps(({ status, isLastFragment }) => ({ withProps(({ status, isAdmin, isLastFragment }) => ({
canEdit: canEditManuscript:
isLastFragment && !(status === 'accepted' || status === 'rejected'), isAdmin &&
isLastFragment &&
!(status === 'accepted' || status === 'rejected'),
})), })),
withHandlers({ withHandlers({
getButtonText: ({ isLastStep, isEditMode }) => () => { getButtonText: ({ isLastStep, isEditMode }) => () => {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment