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) => {
return get(collection, 'handlingEditor.id') === currentUserId
}
const canMakeRecommendationStatuses = ['reviewCompleted', 'heAssigned']
const canMakeRecommendationStatuses = [
'reviewCompleted',
'heAssigned',
'underReview',
]
export const canMakeRecommendation = (state, collection, fragment = {}) => {
if (fragment.id !== last(collection.fragments)) return false
const isHE = isHEToManuscript(state, collection.id)
......
......@@ -40,6 +40,7 @@ const SideBarActions = ({
collectionId={project.id}
fragmentId={version.id}
modalKey={`decide-${version.id}`}
status={project.status}
/>
)}
......
......@@ -74,7 +74,6 @@ const DashboardCard = ({
collectionId={project.id}
fragmentId={version.id}
modalKey={`recommend-${version.id}`}
status={project.status}
/>
)}
<ZipFiles
......
......@@ -9,7 +9,10 @@ import { getFormValues, reset as resetForm } from 'redux-form'
import { FormItems } from '../UIComponents'
import { StepOne, StepTwo, utils } from './'
import { createRecommendation } from '../../redux/recommendations'
import {
createRecommendation,
selectReviewRecommendations,
} from '../../redux/recommendations'
const RecommendWizard = ({
step,
......@@ -40,8 +43,9 @@ const RecommendWizard = ({
export default compose(
connect(
state => ({
(state, { fragmentId }) => ({
decision: get(getFormValues('recommendation')(state), 'decision'),
reviews: selectReviewRecommendations(state, fragmentId),
}),
{
resetForm,
......
import React from 'react'
import { reduxForm } from 'redux-form'
import { isEmpty } from 'lodash'
import { RadioGroup, ValidatedField, Button } from '@pubsweet/ui'
import { utils } from './'
......@@ -7,7 +8,7 @@ import { FormItems } from '../UIComponents'
const { Row, Title, RowItem, RootContainer, CustomRadioGroup } = FormItems
const StepOne = ({ hideModal, disabled, onSubmit, status }) => (
const StepOne = ({ hideModal, disabled, onSubmit, reviews }) => (
<RootContainer>
<Title>Recommendation for Next Phase</Title>
<Row>
......@@ -21,7 +22,7 @@ const StepOne = ({ hideModal, disabled, onSubmit, status }) => (
<RadioGroup
name="decision"
options={
status === 'reviewCompleted'
!isEmpty(reviews)
? utils.recommendationOptions
: 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