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

fix(submissionWizzard): Author can create manuscript.

parent 360ae6a6
No related branches found
No related tags found
2 merge requests!233S26 updates,!230S26 Updates
...@@ -24,7 +24,10 @@ import { ...@@ -24,7 +24,10 @@ import {
} from 'recompose' } from 'recompose'
import { Row, MultiAction, IconButton } from 'pubsweet-component-faraday-ui' import { Row, MultiAction, IconButton } from 'pubsweet-component-faraday-ui'
import { withModal } from 'pubsweet-component-modal/src/components' 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 { import {
reduxForm, reduxForm,
...@@ -135,6 +138,10 @@ export default compose( ...@@ -135,6 +138,10 @@ export default compose(
submitFailed: hasSubmitFailed('submission')(state), submitFailed: hasSubmitFailed('submission')(state),
formSyncErrors: getFormSyncErrors('submission')(state), formSyncErrors: getFormSyncErrors('submission')(state),
isAdmin: get(selectCurrentUser(state), 'admin', false), 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')), 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),
...@@ -188,9 +195,9 @@ export default compose( ...@@ -188,9 +195,9 @@ export default compose(
status: get(collection, 'status', ''), status: get(collection, 'status', ''),
}), }),
), ),
withProps(({ status, isAdmin, isLastFragment }) => ({ withProps(({ status, isAdmin, isAuthor, isLastFragment }) => ({
canEditManuscript: canEditManuscript:
isAdmin && (isAdmin || (isAuthor && status === 'draft')) &&
isLastFragment && isLastFragment &&
!(status === 'accepted' || status === 'rejected'), !(status === 'accepted' || status === 'rejected'),
})), })),
......
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