Fixes: U4-7691 7.4 beta - Document composition is not working with media types

Media type compositions weren't getting added since it only looked up through the content type service.
This commit is contained in:
Claus
2016-02-03 15:02:44 +01:00
parent c4981b50e5
commit 24d42e6bd1

View File

@@ -69,7 +69,12 @@ namespace Umbraco.Web.Models.Mapping
foreach (var a in add)
{
//TODO: Remove N+1 lookup
var addCt = applicationContext.Services.ContentTypeService.GetContentType(a);
//since we don't really know from the alias what type of content type this is,
//we look up by content type first and then by media type if not found.
//content type aliases are unique so this should be safe to do.
IContentTypeComposition addCt = applicationContext.Services.ContentTypeService.GetContentType(a);
if (addCt == null)
addCt = applicationContext.Services.ContentTypeService.GetMediaType(a);
if (addCt != null)
dest.AddContentType(addCt);
}