diff --git a/src/Umbraco.Core/Persistence/Repositories/ContentTypeBaseRepository.cs b/src/Umbraco.Core/Persistence/Repositories/ContentTypeBaseRepository.cs
index 4d401ce6f8..69890baac6 100644
--- a/src/Umbraco.Core/Persistence/Repositories/ContentTypeBaseRepository.cs
+++ b/src/Umbraco.Core/Persistence/Repositories/ContentTypeBaseRepository.cs
@@ -1251,7 +1251,12 @@ WHERE cmsContentType." + aliasColumn + @" LIKE @pattern",
return test;
}
- internal bool HasContainerInPath(string contentPath)
+ ///
+ /// Given the path of a content item, this will return true if the content item exists underneath a list view content item
+ ///
+ ///
+ ///
+ public bool HasContainerInPath(string contentPath)
{
var ids = contentPath.Split(',').Select(int.Parse);
var sql = new Sql(@"SELECT COUNT(pk) FROM cmsContentType
diff --git a/src/Umbraco.Core/Persistence/Repositories/Interfaces/IContentTypeRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Interfaces/IContentTypeRepository.cs
index 61d83645b3..f118be3b76 100644
--- a/src/Umbraco.Core/Persistence/Repositories/Interfaces/IContentTypeRepository.cs
+++ b/src/Umbraco.Core/Persistence/Repositories/Interfaces/IContentTypeRepository.cs
@@ -8,6 +8,13 @@ namespace Umbraco.Core.Persistence.Repositories
{
public interface IContentTypeRepository : IContentTypeCompositionRepository
{
+ ///
+ /// Given the path of a content item, this will return true if the content item exists underneath a list view content item
+ ///
+ ///
+ ///
+ bool HasContainerInPath(string contentPath);
+
///
/// Gets all entities of the specified query
///
diff --git a/src/Umbraco.Core/Services/ContentTypeServiceBase.cs b/src/Umbraco.Core/Services/ContentTypeServiceBase.cs
index 231186b99f..2067de847c 100644
--- a/src/Umbraco.Core/Services/ContentTypeServiceBase.cs
+++ b/src/Umbraco.Core/Services/ContentTypeServiceBase.cs
@@ -72,12 +72,17 @@ namespace Umbraco.Core.Services
}
- internal bool HasContainerInPath(string contentPath)
+ ///
+ /// Given the path of a content item, this will return true if the content item exists underneath a list view content item
+ ///
+ ///
+ ///
+ public bool HasContainerInPath(string contentPath)
{
using (var uow = UowProvider.GetUnitOfWork())
{
// can use same repo for both content and media
- var repository = (ContentTypeRepository) RepositoryFactory.CreateContentTypeRepository(uow);
+ var repository = RepositoryFactory.CreateContentTypeRepository(uow);
return repository.HasContainerInPath(contentPath);
}
}
diff --git a/src/Umbraco.Core/Services/IContentTypeService.cs b/src/Umbraco.Core/Services/IContentTypeService.cs
index 2dcdf01291..46ee8520c6 100644
--- a/src/Umbraco.Core/Services/IContentTypeService.cs
+++ b/src/Umbraco.Core/Services/IContentTypeService.cs
@@ -11,6 +11,13 @@ namespace Umbraco.Core.Services
///
public interface IContentTypeService : IService
{
+ ///
+ /// Given the path of a content item, this will return true if the content item exists underneath a list view content item
+ ///
+ ///
+ ///
+ bool HasContainerInPath(string contentPath);
+
int CountContentTypes();
int CountMediaTypes();
diff --git a/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs b/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs
index 2fd57b6290..cc2ee79ccb 100644
--- a/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs
+++ b/src/Umbraco.Web/Models/Mapping/ContentModelMapper.cs
@@ -88,7 +88,7 @@ namespace Umbraco.Web.Models.Mapping
{
// map the IsChildOfListView (this is actually if it is a descendant of a list view!)
var parent = content.Parent();
- display.IsChildOfListView = parent != null && (parent.ContentType.IsContainer || ((ContentTypeService) contentTypeService).HasContainerInPath(parent.Path));
+ display.IsChildOfListView = parent != null && (parent.ContentType.IsContainer || contentTypeService.HasContainerInPath(parent.Path));
//map the tree node url
if (HttpContext.Current != null)
@@ -214,6 +214,7 @@ namespace Umbraco.Web.Models.Mapping
}
if (content.HasPublishedVersion)
{
+ //TODO: This is horribly inneficient
var published = applicationContext.Services.ContentService.GetPublishedVersion(content.Id);
return published.UpdateDate;
}
diff --git a/src/Umbraco.Web/Models/Mapping/MediaModelMapper.cs b/src/Umbraco.Web/Models/Mapping/MediaModelMapper.cs
index cfc254b085..867ae2f00b 100644
--- a/src/Umbraco.Web/Models/Mapping/MediaModelMapper.cs
+++ b/src/Umbraco.Web/Models/Mapping/MediaModelMapper.cs
@@ -69,7 +69,7 @@ namespace Umbraco.Web.Models.Mapping
// Adapted from ContentModelMapper
//map the IsChildOfListView (this is actually if it is a descendant of a list view!)
var parent = media.Parent();
- display.IsChildOfListView = parent != null && (parent.ContentType.IsContainer || ((ContentTypeService) contentTypeService).HasContainerInPath(parent.Path));
+ display.IsChildOfListView = parent != null && (parent.ContentType.IsContainer || contentTypeService.HasContainerInPath(parent.Path));
//map the tree node url
if (HttpContext.Current != null)