diff --git a/packages/component-wizard/src/components/SubmissionWizard.js b/packages/component-wizard/src/components/SubmissionWizard.js index c5783d65e86661213d325455f230c577409e6c7f..b5db2e8c1b65820b735e17ed5515e214516e18eb 100644 --- a/packages/component-wizard/src/components/SubmissionWizard.js +++ b/packages/component-wizard/src/components/SubmissionWizard.js @@ -24,7 +24,10 @@ import { } from 'recompose' import { Row, MultiAction, IconButton } from 'pubsweet-component-faraday-ui' import { withModal } from 'pubsweet-component-modal/src/components' -import { getUserToken } from 'pubsweet-component-faraday-selectors/src' +import { + getUserToken, + currentUserIsAuthor, +} from 'pubsweet-component-faraday-selectors/src' import { reduxForm, @@ -135,6 +138,10 @@ export default compose( submitFailed: hasSubmitFailed('submission')(state), formSyncErrors: getFormSyncErrors('submission')(state), isAdmin: get(selectCurrentUser(state), 'admin', false), + isAuthor: currentUserIsAuthor( + state, + get(selectFragment(state, get(match, 'params.version')), 'id', null), + ), fragment: selectFragment(state, get(match, 'params.version')), collection: selectCollection(state, get(match, 'params.project')), isAuthorsFetching: getAuthorFetching(state) || getAutosaveFetching(state), @@ -188,9 +195,9 @@ export default compose( status: get(collection, 'status', ''), }), ), - withProps(({ status, isAdmin, isLastFragment }) => ({ + withProps(({ status, isAdmin, isAuthor, isLastFragment }) => ({ canEditManuscript: - isAdmin && + (isAdmin || (isAuthor && status === 'draft')) && isLastFragment && !(status === 'accepted' || status === 'rejected'), })),