Skip to content

Commit

Permalink
Merge pull request #3353 from reactioncommerce/release-1.5.11
Browse files Browse the repository at this point in the history
Release 1.5.11
  • Loading branch information
spencern authored Nov 28, 2017
2 parents 556b7a0 + 2abf1ec commit 70c2c74
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,20 @@ const wrapComponent = (Comp) => (
// check whether all required fields have been submitted before publishing
checkValidation = () => {
// this returns an array with a single object
const variants = ReactionProduct.getVariants(this.props.product._id).map((variant) => this.validation.validate(variant));
this.setState({
validProduct: Object.assign({}, this.props.product, { __isValid: variants[0].isValid })
});
const variants = ReactionProduct.getVariants(this.props.product._id);

// should validate variants if they exist to determine if product is Valid
if (variants.length !== 0) {
const validatedVariants = variants.map((variant) => this.validation.validate(variant));
this.setState({
validProduct: Object.assign({}, this.props.product, { __isValid: validatedVariants[0].isValid })
});
} else {
// if variants do not exist then validation should pass
this.setState({
validProduct: Object.assign({}, this.props.product, { __isValid: true })
});
}
}

checked = () => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "reaction",
"description": "Reaction is a modern reactive, real-time event driven ecommerce platform.",
"version": "1.5.10",
"version": "1.5.11",
"main": "main.js",
"directories": {
"test": "tests"
Expand Down

0 comments on commit 70c2c74

Please sign in to comment.