Skip to content

Commit 63aa24b

Browse files
authored
Merge pull request #2433 from appirio-tech/issue-2410
Fix issue 2410: Enforce minimum design selection at checkpoint review milestone
2 parents 9b3f210 + 79e6274 commit 63aa24b

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/projects/detail/components/timeline/milestones/MilestoneTypeCheckpointReview/MilestoneTypeCheckpointReview.jsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class MilestoneTypeCheckpointReview extends React.Component {
4040
this.completeReview = this.completeReview.bind(this)
4141
this.toggleRejectedSection = this.toggleRejectedSection.bind(this)
4242
this.moveToReviewingState = this.moveToReviewingState.bind(this)
43+
this.shouldDisableCompleteReviewButton = this.shouldDisableCompleteReviewButton.bind(this)
4344
}
4445

4546
getLinksForReview() {
@@ -180,6 +181,18 @@ class MilestoneTypeCheckpointReview extends React.Component {
180181
return milestone[`${milestone.status}Text`]
181182
}
182183

184+
shouldDisableCompleteReviewButton(links, selectedLinks) {
185+
const linksLength = links.length
186+
const selectedLinksLength = selectedLinks.length
187+
if (linksLength < 5 && selectedLinksLength === linksLength) {
188+
return false
189+
} else if (linksLength >= 5 && selectedLinksLength >= 5) {
190+
return false
191+
} else {
192+
return true
193+
}
194+
}
195+
183196
render() {
184197
const {
185198
milestone,
@@ -361,7 +374,7 @@ class MilestoneTypeCheckpointReview extends React.Component {
361374
<button
362375
className={'tc-btn tc-btn-primary'}
363376
onClick={!currentUser.isCustomer ? this.showCompleteReviewConfirmation : this.completeReview}
364-
disabled={!isInReview}
377+
disabled={this.shouldDisableCompleteReviewButton(links, selectedLinks) && !isInReview}
365378
>
366379
Complete review ({
367380
daysLeft >= 0

0 commit comments

Comments
 (0)