v8 - Fixes multiple issues with variant validation#4955
Merged
Conversation
bjarnef
reviewed
Mar 12, 2019
| variants: _.map(displayModel.variants, function(v) { | ||
| return { | ||
| name: v.name, | ||
| name: v.name ? v.name : "", //if its null/empty,we must pass up an empty string else we get json converter errors |
Contributor
There was a problem hiding this comment.
@Shazwazza I think this also can be written as name: v.name || ""
Contributor
Author
There was a problem hiding this comment.
@bjarnef ah of course, i always forget about that operator in JS thanks!
…t-validation-fixes-4884
…t-validation-fixes-4884
…nly the cultures passed in to to the method, removes client side name check,
…rom the publish dialog since it's not needed
…andatory language has validation problems
…t-validation-fixes-4884
…tent publish dialog is invalid
…for publish/schedule
…dated on the default lang or if the item is not published
# Conflicts: # src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml
…ures since it wouldn't actually save the content if it was invalid - we always must save even if data is invalid, this was an oversight with the rush to release with these last minute APIs
…ted with invariant property issues
…github.com/umbraco/Umbraco-CMS into temp8-server-content-validation-fixes-4884
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4884
This PR fixes/updates several things:
Nameis empty. If that were attempted an exception would be thrown. The UI should prevent that from happening but the c# should always validate that, so this is fixedContentService.SaveAndPublishhas been fixed, previously if the user had only selected 2 out of 3 cultures to publish and the other culture had invalid/empty properties, theContentService.SaveAndPublishwould still validate all 3 cultures! This meant that the user would get back some strange warnings and nothing would actually be persisted.To see the changed files without whitespace changes, use this: https://github.com/umbraco/Umbraco-CMS/pull/4955/files?w=1
I have renamed a couple classes to clean things up a little, added some tests and notes.
Testing ... well there's a lot of combinations to test here so please use your imagination. Pro tip #1:
Create 2 mandatory langs, a variant doc type with 2 text properties that both validate as mandatory and as a Number and make one of those properties invariant.
This will give you a nice testing ground for server side validation with mandatory requirements, then test creating new content, updating content, with valid/invalid combinations. Pro tip #2: If you navigate to a language, enter a value for it's name and then clear that value it will be marked as dirty, then navigate to another language and go to save/publish, it will still allow you to try to publish the other language even though the name is null. Server side validation will take care of this, but its another combination to test.
Then be sure that invariant content validation still works as expected too.