Fixes U4-5986 Compositions: Possible to get stuck in document type ysod's

#U4-5986 Fixed Due in version 7.2.1
This commit is contained in:
Sebastiaan Janssen
2014-12-09 19:30:48 +01:00
parent 9dcba6a679
commit 848e8a6248

View File

@@ -24,13 +24,18 @@ namespace umbraco
//NOTE: TypeID is the parent id!
//NOTE: ParentID is aparently a flag to determine if we are to create a template! Hack much ?! :P
var parentId = TypeID != 0 ? TypeID : -1;
var contentType = parentId == -1
? new ContentType(-1)
: new ContentType(ApplicationContext.Current.Services.ContentTypeService.GetContentType(parentId));
contentType.CreatorId = User.Id;
// when creating a content type, enforce PascalCase
// preserve separator because contentType.Alias will re-alias it
contentType.Alias = Alias.ToCleanString(CleanStringType.Alias | CleanStringType.PascalCase, ' ');
var cleanAlias = Alias.ToCleanString(CleanStringType.Alias | CleanStringType.PascalCase, ' ');
var contentType = parentId == -1
? new ContentType(-1)
: new ContentType(ApplicationContext.Current.Services.ContentTypeService.GetContentType(parentId), cleanAlias);
contentType.CreatorId = User.Id;
contentType.Alias = cleanAlias;
contentType.Name = Alias.Replace("'", "''");
contentType.Icon = ".sprTreeFolder";