Publishing in the Management API (#14774)
* make CoreScopeProvider available for derived classes * Create publish controller * Add publish functionality * Remove unneeded using * Implement publish for multiple cultures * support multiple cultures in controler * Dont validate properties * Refactor to use PublishingOperationStatus * refactor to use proper publish async methods * Refactor publish logic into own service * Commit some demo code * Add notes about what errors can happen when publishing * Rework ContentPublishingService and introduce explicit Publish and PublishBranch methods in ContentService * Fix merge * Allow the publishing strategy to do its job * Improved check for unsaved changes * Make the old content controller work (as best possible) * Remove SaveAndPublish (SaveAndPublishBranch) from all tests * Proper guards for invalid cultures when publishing * Fix edge cases for property validation and content unpublishing + add unpublishing to ContentPublishingService * Clear out a few TODOs - we'll accept the behavior for now * Unpublish controller * Fix merge * Fix branch publish notifications * Added extra test for publishing unpublished cultures and added FIXME comments for when we fix the state of published cultures in content --------- Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com> Co-authored-by: Zeegaan <nge@umbraco.dk>
This commit is contained in:
@@ -574,6 +574,44 @@ public class VariationTests
|
||||
prop.PublishValues();
|
||||
}
|
||||
|
||||
[TestCase(true, true)]
|
||||
[TestCase(true, false)]
|
||||
[TestCase(false, true)]
|
||||
[TestCase(false, false)]
|
||||
public void NoValueTests(bool variesByCulture, bool variesBySegment)
|
||||
{
|
||||
var variation = variesByCulture && variesBySegment
|
||||
? ContentVariation.CultureAndSegment
|
||||
: variesByCulture
|
||||
? ContentVariation.Culture
|
||||
: variesBySegment
|
||||
? ContentVariation.Segment
|
||||
: ContentVariation.Nothing;
|
||||
|
||||
var culture = variesByCulture ? "en-US" : null;
|
||||
var segment = variesBySegment ? "my-segment" : null;
|
||||
|
||||
var propertyType = new PropertyTypeBuilder()
|
||||
.WithAlias("prop")
|
||||
.WithSupportsPublishing(true)
|
||||
.WithVariations(variation)
|
||||
.Build();
|
||||
|
||||
var prop = new Property(propertyType);
|
||||
var propertyValidationService = GetPropertyValidationService();
|
||||
|
||||
// "no value" is valid for non-mandatory properties
|
||||
Assert.IsTrue(propertyValidationService.IsPropertyValid(prop, culture, segment));
|
||||
|
||||
propertyType.Mandatory = true;
|
||||
|
||||
// "no value" is NOT valid for mandatory properties
|
||||
Assert.IsFalse(propertyValidationService.IsPropertyValid(prop, culture, segment));
|
||||
|
||||
// can publish, even though invalid
|
||||
prop.PublishValues();
|
||||
}
|
||||
|
||||
private static Content CreateContent(IContentType contentType, int id = 1, string name = "content") =>
|
||||
new ContentBuilder()
|
||||
.WithId(id)
|
||||
|
||||
Reference in New Issue
Block a user