Fixes some logic with validation

This commit is contained in:
Shannon
2018-11-13 16:57:38 +11:00
parent c6ef3750df
commit ac5c76385c
2 changed files with 10 additions and 6 deletions

View File

@@ -22,8 +22,9 @@
var published = !(variant.state === "NotCreated" || variant.state === "Draft");
if ((variant.language.isMandatory && !published) && (!publishable || !variant.publish)) {
//if a mandatory variant isn't published and it's not publishable or not selected to be published
//then we cannot publish anything
//if a mandatory variant isn't published
//and it's not publishable or not selected to be published
//then we cannot continue
//TODO: Show a message when this occurs
return false;

View File

@@ -328,10 +328,13 @@
var published = !(variant.state === "NotCreated" || variant.state === "Draft");
var isScheduledPublished = variant.releaseDate;
if (isMandatory) {
if (!publishable || (!published && !isScheduledPublished)) {
return false;
}
if (isMandatory && !published && !isScheduledPublished && (!publishable || !variant.save)) {
//if a mandatory variant isn't published or scheduled published
//and it's not publishable or not selected to be published
//then we cannot continue
//TODO: Show a message when this occurs
return false;
}
if (variant.save && (variant.releaseDate || variant.expireDate)) {