removes fixme, adds comments and null checks

This commit is contained in:
Shannon
2019-02-07 11:53:43 +11:00
parent 030b626350
commit 562855a687
3 changed files with 9 additions and 9 deletions

View File

@@ -1,17 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Umbraco.Core.Models;
using Umbraco.Core.Services;
namespace Umbraco.Core
{
// fixme
public static class ContentTypeBaseServiceProviderExtensions
internal static class ContentTypeBaseServiceProviderExtensions
{
//TODO: Maybe this should just be on the IContentTypeBaseServiceProvider interface?
public static IContentTypeComposition GetContentTypeOf(this IContentTypeBaseServiceProvider serviceProvider, IContentBase contentBase)
=> serviceProvider.For(contentBase).Get(contentBase.ContentTypeId);
{
if (contentBase == null) throw new ArgumentNullException(nameof(contentBase));
return serviceProvider.For(contentBase)?.Get(contentBase.ContentTypeId);
}
}
}

View File

@@ -18,6 +18,7 @@ namespace Umbraco.Core.Services.Implement
public IContentTypeBaseService For(IContentBase contentBase)
{
if (contentBase == null) throw new ArgumentNullException(nameof(contentBase));
switch (contentBase)
{
case IContent _:

View File

@@ -199,8 +199,8 @@ namespace Umbraco.Web.Macros
Key = _inner.Key;
// TODO: ARGH! need to fix this - this is not good because it uses ApplicationContext.Current
CreatorName = _inner.GetCreatorProfile().Name;
WriterName = _inner.GetWriterProfile().Name;
CreatorName = _inner.GetCreatorProfile()?.Name;
WriterName = _inner.GetWriterProfile()?.Name;
var contentType = Current.Services.ContentTypeBaseServices.GetContentTypeOf(_inner);
ContentType = Current.PublishedContentTypeFactory.CreateContentType(contentType);