Skip to content
Snippets Groups Projects
Commit f146319b authored by Bogdan Cochior's avatar Bogdan Cochior
Browse files

fix(he-recommendation): hide publish if no reviews

parent bebf1544
No related branches found
No related tags found
2 merge requests!34Sprint 17 features,!28fix(he-recommendation): hide publish if no reviews
This commit is part of merge request !34. Comments created here will be created in the context of that merge request.
...@@ -7,7 +7,11 @@ export const isHEToManuscript = (state, collectionId) => { ...@@ -7,7 +7,11 @@ export const isHEToManuscript = (state, collectionId) => {
return get(collection, 'handlingEditor.id') === currentUserId return get(collection, 'handlingEditor.id') === currentUserId
} }
const canMakeRecommendationStatuses = ['reviewCompleted', 'heAssigned'] const canMakeRecommendationStatuses = [
'reviewCompleted',
'heAssigned',
'underReview',
]
export const canMakeRecommendation = (state, collection, fragment = {}) => { export const canMakeRecommendation = (state, collection, fragment = {}) => {
if (fragment.id !== last(collection.fragments)) return false if (fragment.id !== last(collection.fragments)) return false
const isHE = isHEToManuscript(state, collection.id) const isHE = isHEToManuscript(state, collection.id)
......
...@@ -40,6 +40,7 @@ const SideBarActions = ({ ...@@ -40,6 +40,7 @@ const SideBarActions = ({
collectionId={project.id} collectionId={project.id}
fragmentId={version.id} fragmentId={version.id}
modalKey={`decide-${version.id}`} modalKey={`decide-${version.id}`}
status={project.status}
/> />
)} )}
......
...@@ -74,7 +74,6 @@ const DashboardCard = ({ ...@@ -74,7 +74,6 @@ const DashboardCard = ({
collectionId={project.id} collectionId={project.id}
fragmentId={version.id} fragmentId={version.id}
modalKey={`recommend-${version.id}`} modalKey={`recommend-${version.id}`}
status={project.status}
/> />
)} )}
<ZipFiles <ZipFiles
......
...@@ -9,7 +9,10 @@ import { getFormValues, reset as resetForm } from 'redux-form' ...@@ -9,7 +9,10 @@ import { getFormValues, reset as resetForm } from 'redux-form'
import { FormItems } from '../UIComponents' import { FormItems } from '../UIComponents'
import { StepOne, StepTwo, utils } from './' import { StepOne, StepTwo, utils } from './'
import { createRecommendation } from '../../redux/recommendations' import {
createRecommendation,
selectReviewRecommendations,
} from '../../redux/recommendations'
const RecommendWizard = ({ const RecommendWizard = ({
step, step,
...@@ -40,8 +43,9 @@ const RecommendWizard = ({ ...@@ -40,8 +43,9 @@ const RecommendWizard = ({
export default compose( export default compose(
connect( connect(
state => ({ (state, { fragmentId }) => ({
decision: get(getFormValues('recommendation')(state), 'decision'), decision: get(getFormValues('recommendation')(state), 'decision'),
reviews: selectReviewRecommendations(state, fragmentId),
}), }),
{ {
resetForm, resetForm,
......
import React from 'react' import React from 'react'
import { reduxForm } from 'redux-form' import { reduxForm } from 'redux-form'
import { isEmpty } from 'lodash'
import { RadioGroup, ValidatedField, Button } from '@pubsweet/ui' import { RadioGroup, ValidatedField, Button } from '@pubsweet/ui'
import { utils } from './' import { utils } from './'
...@@ -7,7 +8,7 @@ import { FormItems } from '../UIComponents' ...@@ -7,7 +8,7 @@ import { FormItems } from '../UIComponents'
const { Row, Title, RowItem, RootContainer, CustomRadioGroup } = FormItems const { Row, Title, RowItem, RootContainer, CustomRadioGroup } = FormItems
const StepOne = ({ hideModal, disabled, onSubmit, status }) => ( const StepOne = ({ hideModal, disabled, onSubmit, reviews }) => (
<RootContainer> <RootContainer>
<Title>Recommendation for Next Phase</Title> <Title>Recommendation for Next Phase</Title>
<Row> <Row>
...@@ -21,7 +22,7 @@ const StepOne = ({ hideModal, disabled, onSubmit, status }) => ( ...@@ -21,7 +22,7 @@ const StepOne = ({ hideModal, disabled, onSubmit, status }) => (
<RadioGroup <RadioGroup
name="decision" name="decision"
options={ options={
status === 'reviewCompleted' !isEmpty(reviews)
? utils.recommendationOptions ? utils.recommendationOptions
: utils.recommendationOptions.slice(1) : utils.recommendationOptions.slice(1)
} }
......
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