Fixes Publishing/Unpublishing variants and it's nuances

This commit is contained in:
Shannon
2018-05-07 23:22:52 +10:00
parent 7a92691bf5
commit 5a991c9424
21 changed files with 281 additions and 128 deletions

View File

@@ -194,15 +194,23 @@ namespace Umbraco.Core.Models
Name = null;
return;
}
if (!ContentTypeBase.Variations.HasAny(ContentVariation.CultureNeutral | ContentVariation.CultureSegment))
throw new NotSupportedException("Content type does not support varying name by culture.");
if (_names == null) return;
if (_names == null) return;
if (!_names.ContainsKey(culture))
throw new InvalidOperationException($"Cannot unpublish culture {culture}, the document contains only cultures {string.Join(", ", _names.Keys)}");
_names.Remove(culture);
if (_names.Count == 0)
_names = null;
}
protected virtual void ClearNames()
{
{
if (!ContentTypeBase.Variations.HasAny(ContentVariation.CultureNeutral | ContentVariation.CultureSegment))
throw new NotSupportedException("Content type does not support varying name by culture.");
_names = null;
OnPropertyChanged(Ps.Value.NamesSelector);
}