diff --git a/src/Umbraco.Cms.Api.Management/Factories/DocumentTypeEditingPresentationFactory.cs b/src/Umbraco.Cms.Api.Management/Factories/DocumentTypeEditingPresentationFactory.cs index b77363b698..de6ed6ebf6 100644 --- a/src/Umbraco.Cms.Api.Management/Factories/DocumentTypeEditingPresentationFactory.cs +++ b/src/Umbraco.Cms.Api.Management/Factories/DocumentTypeEditingPresentationFactory.cs @@ -28,6 +28,7 @@ internal sealed class DocumentTypeEditingPresentationFactory : ContentTypeEditin createModel.ContainerKey = requestModel.Folder?.Id; createModel.AllowedTemplateKeys = requestModel.AllowedTemplates.Select(reference => reference.Id).ToArray(); createModel.DefaultTemplateKey = requestModel.DefaultTemplate?.Id; + createModel.ListView = requestModel.Collection?.Id; createModel.AllowedContentTypes = MapAllowedContentTypes(requestModel.AllowedDocumentTypes); createModel.Compositions = MapCompositions(requestModel.Compositions); @@ -48,6 +49,7 @@ internal sealed class DocumentTypeEditingPresentationFactory : ContentTypeEditin updateModel.AllowedTemplateKeys = requestModel.AllowedTemplates.Select(reference => reference.Id).ToArray(); updateModel.DefaultTemplateKey = requestModel.DefaultTemplate?.Id; + updateModel.ListView = requestModel.Collection?.Id; updateModel.AllowedContentTypes = MapAllowedContentTypes(requestModel.AllowedDocumentTypes); updateModel.Compositions = MapCompositions(requestModel.Compositions); diff --git a/src/Umbraco.Cms.Api.Management/Factories/MediaTypeEditingPresentationFactory.cs b/src/Umbraco.Cms.Api.Management/Factories/MediaTypeEditingPresentationFactory.cs index 5344feead2..b2e9aa6132 100644 --- a/src/Umbraco.Cms.Api.Management/Factories/MediaTypeEditingPresentationFactory.cs +++ b/src/Umbraco.Cms.Api.Management/Factories/MediaTypeEditingPresentationFactory.cs @@ -27,6 +27,7 @@ internal sealed class MediaTypeEditingPresentationFactory : ContentTypeEditingPr createModel.ContainerKey = requestModel.Folder?.Id; createModel.AllowedContentTypes = MapAllowedContentTypes(requestModel.AllowedMediaTypes); createModel.Compositions = MapCompositions(requestModel.Compositions); + createModel.ListView = requestModel.Collection?.Id; return createModel; } @@ -43,6 +44,7 @@ internal sealed class MediaTypeEditingPresentationFactory : ContentTypeEditingPr updateModel.AllowedContentTypes = MapAllowedContentTypes(requestModel.AllowedMediaTypes); updateModel.Compositions = MapCompositions(requestModel.Compositions); + updateModel.ListView = requestModel.Collection?.Id; return updateModel; } diff --git a/src/Umbraco.Cms.Api.Management/Mapping/DocumentType/DocumentTypeMapDefinition.cs b/src/Umbraco.Cms.Api.Management/Mapping/DocumentType/DocumentTypeMapDefinition.cs index 8b81f5d7b8..aa2bd1ac55 100644 --- a/src/Umbraco.Cms.Api.Management/Mapping/DocumentType/DocumentTypeMapDefinition.cs +++ b/src/Umbraco.Cms.Api.Management/Mapping/DocumentType/DocumentTypeMapDefinition.cs @@ -1,4 +1,5 @@ -using Umbraco.Cms.Api.Management.Mapping.ContentType; +using Umbraco.Cms.Api.Management.Extensions; +using Umbraco.Cms.Api.Management.Mapping.ContentType; using Umbraco.Cms.Api.Management.ViewModels; using Umbraco.Cms.Api.Management.ViewModels.DocumentType; using Umbraco.Cms.Core.Mapping; @@ -30,6 +31,7 @@ public class DocumentTypeMapDefinition : ContentTypeMapDefinition @@ -64,7 +66,7 @@ public class DocumentTypeMapDefinition : ContentTypeMapDefinition @@ -47,7 +50,7 @@ public class MediaTypeMapDefinition : ContentTypeMapDefinition((_, _) => new MemberTypeReferenceResponseModel(), Map); } - // Umbraco.Code.MapAll + // Umbraco.Code.MapAll -Collection private void Map(IMemberType source, MemberTypeResponseModel target, MapperContext context) { target.Id = source.Key; @@ -30,6 +30,7 @@ public class MemberTypeMapDefinition : ContentTypeMapDefinition new MemberTypeComposition { MemberType = new ReferenceByIdModel(contentTypeComposition.Key), @@ -37,19 +38,17 @@ public class MemberTypeMapDefinition : ContentTypeMapDefinition AllowedMediaTypes { get; set; } = Enumerable.Empty(); public IEnumerable Compositions { get; set; } = Enumerable.Empty(); + + public ReferenceByIdModel? Collection { get; set; } } diff --git a/src/Umbraco.Core/ContentApps/ContentEditorContentAppFactory.cs b/src/Umbraco.Core/ContentApps/ContentEditorContentAppFactory.cs index ac8b3a2061..2ee4353005 100644 --- a/src/Umbraco.Core/ContentApps/ContentEditorContentAppFactory.cs +++ b/src/Umbraco.Core/ContentApps/ContentEditorContentAppFactory.cs @@ -27,7 +27,7 @@ public class ContentEditorContentAppFactory : IContentAppFactory Weight = Weight, }; - case IMedia media when !media.ContentType.IsContainer || media.Properties.Count > 0: + case IMedia media when media.ContentType.ListView is null || media.Properties.Count > 0: return _mediaApp ??= new ContentApp { Alias = "umbContent", diff --git a/src/Umbraco.Core/ContentApps/ListViewContentAppFactory.cs b/src/Umbraco.Core/ContentApps/ListViewContentAppFactory.cs index 1d427347d8..8a92660ee5 100644 --- a/src/Umbraco.Core/ContentApps/ListViewContentAppFactory.cs +++ b/src/Umbraco.Core/ContentApps/ListViewContentAppFactory.cs @@ -134,14 +134,14 @@ public class ListViewContentAppFactory : IContentAppFactory switch (o) { - case IContent content when !content.ContentType.IsContainer: + case IContent content when content.ContentType.ListView is null: return null; case IContent content: contentTypeAlias = content.ContentType.Alias; entityType = "content"; dtdId = Constants.DataTypes.DefaultContentListView; break; - case IMedia media when !media.ContentType.IsContainer && + case IMedia media when media.ContentType.ListView is null && media.ContentType.Alias != Constants.Conventions.MediaTypes.Folder: return null; case IMedia media: diff --git a/src/Umbraco.Core/Models/ContentEditing/ContentTypeBasic.cs b/src/Umbraco.Core/Models/ContentEditing/ContentTypeBasic.cs index 0ba344f7fc..488953d7b3 100644 --- a/src/Umbraco.Core/Models/ContentEditing/ContentTypeBasic.cs +++ b/src/Umbraco.Core/Models/ContentEditing/ContentTypeBasic.cs @@ -101,9 +101,9 @@ public class ContentTypeBasic : EntityBasic [ReadOnly(true)] public IDictionary Blueprints { get; set; } - [DataMember(Name = "isContainer")] + [DataMember(Name = "listView")] [ReadOnly(true)] - public bool IsContainer { get; set; } + public Guid? ListView { get; set; } [DataMember(Name = "isElement")] [ReadOnly(true)] diff --git a/src/Umbraco.Core/Models/ContentTypeBase.cs b/src/Umbraco.Core/Models/ContentTypeBase.cs index 6131e1b680..953c15e621 100644 --- a/src/Umbraco.Core/Models/ContentTypeBase.cs +++ b/src/Umbraco.Core/Models/ContentTypeBase.cs @@ -29,7 +29,7 @@ public abstract class ContentTypeBase : TreeEntityBase, IContentTypeBase private string? _description; private bool _hasPropertyTypeBeenRemoved; private string? _icon = "icon-folder"; - private bool _isContainer; + private Guid? _listView; private bool _isElement; private PropertyGroupCollection _propertyGroups; private string? _thumbnail = "folder.png"; @@ -182,17 +182,13 @@ public abstract class ContentTypeBase : TreeEntityBase, IContentTypeBase set => SetPropertyValueAndDetectChanges(value, ref _allowedAsRoot, nameof(AllowedAsRoot)); } - /// - /// Gets or Sets a boolean indicating whether this ContentType is a Container - /// - /// - /// ContentType Containers doesn't show children in the tree, but rather in grid-type view. - /// + + /// [DataMember] - public bool IsContainer + public Guid? ListView { - get => _isContainer; - set => SetPropertyValueAndDetectChanges(value, ref _isContainer, nameof(IsContainer)); + get => _listView; + set => SetPropertyValueAndDetectChanges(value, ref _listView, nameof(ListView)); } /// diff --git a/src/Umbraco.Core/Models/ContentTypeEditing/ContentTypeEditingModelBase.cs b/src/Umbraco.Core/Models/ContentTypeEditing/ContentTypeEditingModelBase.cs index 2f6f205931..3bdc97dbec 100644 --- a/src/Umbraco.Core/Models/ContentTypeEditing/ContentTypeEditingModelBase.cs +++ b/src/Umbraco.Core/Models/ContentTypeEditing/ContentTypeEditingModelBase.cs @@ -30,6 +30,8 @@ public abstract class ContentTypeEditingModelBase Properties { get; set; } = Array.Empty(); public IEnumerable Containers { get; set; } = Array.Empty(); diff --git a/src/Umbraco.Core/Models/IContentTypeBase.cs b/src/Umbraco.Core/Models/IContentTypeBase.cs index adcb4074f9..2e2fe03d56 100644 --- a/src/Umbraco.Core/Models/IContentTypeBase.cs +++ b/src/Umbraco.Core/Models/IContentTypeBase.cs @@ -38,12 +38,12 @@ public interface IContentTypeBase : IUmbracoEntity, IRememberBeingDirty bool AllowedAsRoot { get; set; } /// - /// Gets or Sets a boolean indicating whether this ContentType is a Container + /// Gets or Sets a Guid, which is the key of the listview. /// /// /// ContentType Containers doesn't show children in the tree, but rather in grid-type view. /// - bool IsContainer { get; set; } + Guid? ListView { get; set; } /// /// Gets or sets a value indicating whether this content type is for an element. diff --git a/src/Umbraco.Core/Models/ISimpleContentType.cs b/src/Umbraco.Core/Models/ISimpleContentType.cs index 8246b50ca0..15147093c8 100644 --- a/src/Umbraco.Core/Models/ISimpleContentType.cs +++ b/src/Umbraco.Core/Models/ISimpleContentType.cs @@ -32,9 +32,9 @@ public interface ISimpleContentType string? Icon { get; } /// - /// Gets a value indicating whether the content type is a container. + /// Gets the list view of the content type. /// - bool IsContainer { get; } + Guid? ListView { get; } /// /// Gets a value indicating whether content of that type can be created at the root of the tree. diff --git a/src/Umbraco.Core/Models/Mapping/ContentTypeMapDefinition.cs b/src/Umbraco.Core/Models/Mapping/ContentTypeMapDefinition.cs index 5b10a9e5e7..d91a6e7ffb 100644 --- a/src/Umbraco.Core/Models/Mapping/ContentTypeMapDefinition.cs +++ b/src/Umbraco.Core/Models/Mapping/ContentTypeMapDefinition.cs @@ -368,7 +368,7 @@ public class ContentTypeMapDefinition : IMapDefinition target.Trashed = source.Trashed; target.Id = source.Id; - target.IsContainer = source.IsContainer; + target.ListView = source.ListView; target.IsElement = source.IsElement; target.Key = source.Key; target.Name = source.Name; @@ -572,7 +572,7 @@ public class ContentTypeMapDefinition : IMapDefinition target.Alias = source.Alias; target.Description = source.Description; target.Icon = source.Icon; - target.IsContainer = source.IsContainer; + target.ListView = source.ListView; target.IsElement = source.IsElement; target.Key = source.Key; target.Name = source.Name; @@ -696,7 +696,7 @@ public class ContentTypeMapDefinition : IMapDefinition ? string.Empty : $"{_globalSettings.GetBackOfficePath(_hostingEnvironment).EnsureEndsWith("/")}images/umbraco/{source.Icon}"; target.Id = source.Id; - target.IsContainer = source.IsContainer; + target.ListView = source.ListView; target.IsElement = source.IsElement; target.Key = source.Key; target.Name = source.Name; @@ -752,7 +752,7 @@ public class ContentTypeMapDefinition : IMapDefinition ? string.Empty : $"{_globalSettings.GetBackOfficePath(_hostingEnvironment).EnsureEndsWith("/")}images/umbraco/{source.Icon}"; target.Id = source.Id; - target.IsContainer = source.IsContainer; + target.ListView = source.ListView; target.IsElement = source.IsElement; target.Key = source.Key; target.Name = source.Name; diff --git a/src/Umbraco.Core/Models/SimpleContentType.cs b/src/Umbraco.Core/Models/SimpleContentType.cs index 7fe88a8a8a..ea57be0862 100644 --- a/src/Umbraco.Core/Models/SimpleContentType.cs +++ b/src/Umbraco.Core/Models/SimpleContentType.cs @@ -42,7 +42,7 @@ public class SimpleContentType : ISimpleContentType Alias = contentType.Alias; Variations = contentType.Variations; Icon = contentType.Icon; - IsContainer = contentType.IsContainer; + ListView = contentType.ListView; Name = contentType.Name; AllowedAsRoot = contentType.AllowedAsRoot; IsElement = contentType.IsElement; @@ -61,7 +61,7 @@ public class SimpleContentType : ISimpleContentType public string? Icon { get; } - public bool IsContainer { get; } + public Guid? ListView { get; } public string? Name { get; } diff --git a/src/Umbraco.Core/Services/ContentTypeEditing/ContentTypeEditingServiceBase.cs b/src/Umbraco.Core/Services/ContentTypeEditing/ContentTypeEditingServiceBase.cs index 4fd0e98142..0940b693ff 100644 --- a/src/Umbraco.Core/Services/ContentTypeEditing/ContentTypeEditingServiceBase.cs +++ b/src/Umbraco.Core/Services/ContentTypeEditing/ContentTypeEditingServiceBase.cs @@ -427,6 +427,7 @@ internal abstract class ContentTypeEditingServiceBase("{A8E01644-9F2E-4988-8341-587EF5B7EA69}"); To("{E073DBC0-9E8E-4C92-8210-9CB18364F46E}"); To("{80D282A4-5497-47FF-991F-BC0BCE603121}"); + To("{7FC5AC9B-6F56-415B-913E-4A900629B853}"); To("{96525697-E9DC-4198-B136-25AD033442B8}"); } } diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_14_0_0/AddListViewKeysToDocumentTypes.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_14_0_0/AddListViewKeysToDocumentTypes.cs new file mode 100644 index 0000000000..e79c505a4a --- /dev/null +++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_14_0_0/AddListViewKeysToDocumentTypes.cs @@ -0,0 +1,211 @@ +using NPoco; +using Umbraco.Cms.Core; +using Umbraco.Cms.Core.Models; +using Umbraco.Cms.Core.Services; +using Umbraco.Cms.Infrastructure.Persistence; +using Umbraco.Cms.Infrastructure.Persistence.DatabaseAnnotations; +using Umbraco.Cms.Infrastructure.Persistence.Dtos; +using Umbraco.Cms.Infrastructure.Scoping; +using Umbraco.Extensions; + +namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_14_0_0; + +public class AddListViewKeysToDocumentTypes : UnscopedMigrationBase +{ + private readonly IScopeProvider _scopeProvider; + private readonly IDataTypeService _dataTypeService; + private const string NewColumnName = "listView"; + + public AddListViewKeysToDocumentTypes(IMigrationContext context, IScopeProvider scopeProvider, IDataTypeService dataTypeService) : base(context) + { + _scopeProvider = scopeProvider; + _dataTypeService = dataTypeService; + } + + protected override void Migrate() + { + using IScope scope = _scopeProvider.CreateScope(); + using IDisposable notificationSuppression = scope.Notifications.Suppress(); + ScopeDatabase(scope); + + if (DatabaseType != DatabaseType.SQLite) + { + MigrateSqlServer(); + scope.Complete(); + return; + } + + MigrateSqlite(); + scope.Complete(); + } + + private void MigrateSqlServer() + { + if (ColumnExists(Constants.DatabaseSchema.Tables.ContentType, NewColumnName) is false) + { + IEnumerable contentTypeDtos = GetContentTypeDtos().Where(x => x.ListView is not null); + + Delete.Column("isContainer").FromTable(Constants.DatabaseSchema.Tables.ContentType).Do(); + Create.Column(NewColumnName) + .OnTable(Constants.DatabaseSchema.Tables.ContentType) + .AsGuid() + .Nullable() + .Do(); + + foreach (ContentTypeDto contentTypeDto in contentTypeDtos) + { + Database.Update(contentTypeDto); + } + } + } + + private void MigrateSqlite() + { + if (ColumnExists(Constants.DatabaseSchema.Tables.ContentType, NewColumnName)) + { + return; + } + + /* + * We commit the initial transaction started by the scope. This is required in order to disable the foreign keys. + * We then begin a new transaction, this transaction will be committed or rolled back by the scope, like normal. + * We don't have to worry about re-enabling the foreign keys, since these are enabled by default every time a connection is established. + * + * Ideally we'd want to do this with the unscoped database we get, however, this cannot be done, + * since our scoped database cannot share a connection with the unscoped database, so a new one will be created, which enables the foreign keys. + * Similarly we cannot use Database.CompleteTransaction(); since this also closes the connection, + * so starting a new transaction would re-enable foreign keys. + */ + Database.Execute("COMMIT;"); + Database.Execute("PRAGMA foreign_keys=off;"); + Database.Execute("BEGIN TRANSACTION;"); + + IEnumerable contentTypeDtos = GetContentTypeDtos(); + + Delete.Table(Constants.DatabaseSchema.Tables.ContentType).Do(); + Create.Table().Do(); + + foreach (ContentTypeDto contentTypeDto in contentTypeDtos) + { + Database.Insert(Constants.DatabaseSchema.Tables.ContentType, "pk", false, contentTypeDto); + } + } + + private Guid? CalculateListView(ContentTypeDtoOld dto) + { + if (dto.IsContainer is false) + { + return null; + } + + var name = Constants.Conventions.DataTypes.ListViewPrefix + dto.Alias; + IDataType? listview = _dataTypeService.GetAsync(name).GetAwaiter().GetResult(); + if (listview is not null) + { + return listview.Key; + } + + if (dto.NodeDto.NodeObjectType == Constants.ObjectTypes.DocumentType) + { + return Constants.DataTypes.Guids.ListViewContentGuid; + } + + if (dto.NodeDto.NodeObjectType == Constants.ObjectTypes.MediaType) + { + return Constants.DataTypes.Guids.ListViewMediaGuid; + } + + if (dto.NodeDto.NodeObjectType == Constants.ObjectTypes.MemberType) + { + return Constants.DataTypes.Guids.ListViewMembersGuid; + } + + // No custom list view was found, and not one of the default types either. Therefore we cannot find it. + return null; + } + + private IEnumerable GetContentTypeDtos() + { + Sql sql = Sql() + .SelectAll() + .From() + .InnerJoin() + .On(dto => dto.NodeId, dto => dto.NodeId); + + List? contentTypeDtoOld = Database.Fetch(sql); + + var contentTypeDtos = contentTypeDtoOld.Select(x => new ContentTypeDto + { + PrimaryKey = x.PrimaryKey, + NodeId = x.NodeId, + Alias = x.Alias, + Icon = x.Icon, + Thumbnail = x.Thumbnail, + Description = x.Description, + ListView = CalculateListView(x), + IsElement = x.IsElement, + AllowAtRoot = x.AllowAtRoot, + Variations = x.Variations, + NodeDto = x.NodeDto, + }).ToList(); + + return contentTypeDtos; + } + + + [TableName(Constants.DatabaseSchema.Tables.ContentType)] + [PrimaryKey("pk")] + [ExplicitColumns] + private class ContentTypeDtoOld + { + public const string TableName = Constants.DatabaseSchema.Tables.ContentType; + private string? _alias; + + [Column("pk")] + [PrimaryKeyColumn(IdentitySeed = 700)] + public int PrimaryKey { get; set; } + + [Column("nodeId")] + [ForeignKey(typeof(NodeDto))] + [Index(IndexTypes.UniqueNonClustered, Name = "IX_cmsContentType")] + public int NodeId { get; set; } + + [Column("alias")] + [NullSetting(NullSetting = NullSettings.Null)] + public string? Alias { get => _alias; set => _alias = value == null ? null : string.Intern(value); } + + [Column("icon")] + [Index(IndexTypes.NonClustered)] + [NullSetting(NullSetting = NullSettings.Null)] + public string? Icon { get; set; } + + [Column("thumbnail")] + [Constraint(Default = "folder.png")] + public string? Thumbnail { get; set; } + + [Column("description")] + [NullSetting(NullSetting = NullSettings.Null)] + [Length(1500)] + public string? Description { get; set; } + + [Column("isContainer")] + [Constraint(Default = "0")] + public bool IsContainer { get; set; } + + [Column("isElement")] + [Constraint(Default = "0")] + public bool IsElement { get; set; } + + [Column("allowAtRoot")] + [Constraint(Default = "0")] + public bool AllowAtRoot { get; set; } + + [Column("variations")] + [Constraint(Default = "1" /*ContentVariation.InvariantNeutral*/)] + public byte Variations { get; set; } + + [ResultColumn] + [Reference(ReferenceType.OneToOne, ColumnName = "NodeId")] + public NodeDto NodeDto { get; set; } = null!; + } +} diff --git a/src/Umbraco.Infrastructure/Packaging/PackageDataInstallation.cs b/src/Umbraco.Infrastructure/Packaging/PackageDataInstallation.cs index 9c9c058ee8..28f7cee140 100644 --- a/src/Umbraco.Infrastructure/Packaging/PackageDataInstallation.cs +++ b/src/Umbraco.Infrastructure/Packaging/PackageDataInstallation.cs @@ -841,17 +841,16 @@ namespace Umbraco.Cms.Infrastructure.Packaging contentType.Thumbnail = infoElement.Element("Thumbnail")?.Value; contentType.Description = infoElement.Element("Description")?.Value; - //NOTE AllowAtRoot, IsListView, IsElement and Variations are new properties in the package xml so we need to verify it exists before using it. + //NOTE AllowAtRoot, IsElement and Variations are new properties in the package xml so we need to verify it exists before using it. XElement? allowAtRoot = infoElement.Element("AllowAtRoot"); if (allowAtRoot != null) { contentType.AllowedAsRoot = allowAtRoot.Value.InvariantEquals("true"); } - XElement? isListView = infoElement.Element("IsListView"); - if (isListView != null) + if (Guid.TryParse(infoElement.Element("ListView")?.Value, out Guid listView)) { - contentType.IsContainer = isListView.Value.InvariantEquals("true"); + contentType.ListView = listView; } XElement? isElement = infoElement.Element("IsElement"); diff --git a/src/Umbraco.Infrastructure/Persistence/Dtos/ContentTypeDto.cs b/src/Umbraco.Infrastructure/Persistence/Dtos/ContentTypeDto.cs index 75df880478..ba2530d40d 100644 --- a/src/Umbraco.Infrastructure/Persistence/Dtos/ContentTypeDto.cs +++ b/src/Umbraco.Infrastructure/Persistence/Dtos/ContentTypeDto.cs @@ -39,9 +39,9 @@ internal class ContentTypeDto [Length(1500)] public string? Description { get; set; } - [Column("isContainer")] - [Constraint(Default = "0")] - public bool IsContainer { get; set; } + [Column("listView")] + [NullSetting(NullSetting = NullSettings.Null)] + public Guid? ListView { get; set; } [Column("isElement")] [Constraint(Default = "0")] diff --git a/src/Umbraco.Infrastructure/Persistence/Factories/ContentTypeFactory.cs b/src/Umbraco.Infrastructure/Persistence/Factories/ContentTypeFactory.cs index 095f338399..02d7c6be08 100644 --- a/src/Umbraco.Infrastructure/Persistence/Factories/ContentTypeFactory.cs +++ b/src/Umbraco.Infrastructure/Persistence/Factories/ContentTypeFactory.cs @@ -127,7 +127,7 @@ internal static class ContentTypeFactory Thumbnail = entity.Thumbnail, NodeId = entity.Id, AllowAtRoot = entity.AllowedAsRoot, - IsContainer = entity.IsContainer, + ListView = entity.ListView, IsElement = entity.IsElement, Variations = (byte)entity.Variations, NodeDto = BuildNodeDto(entity, nodeObjectType), @@ -155,7 +155,7 @@ internal static class ContentTypeFactory entity.Level = dto.NodeDto.Level; entity.CreatorId = dto.NodeDto.UserId ?? Constants.Security.UnknownUserId; entity.AllowedAsRoot = dto.AllowAtRoot; - entity.IsContainer = dto.IsContainer; + entity.ListView = dto.ListView; entity.IsElement = dto.IsElement; entity.Trashed = dto.NodeDto.Trashed; diff --git a/src/Umbraco.Infrastructure/Persistence/Mappers/ContentTypeMapper.cs b/src/Umbraco.Infrastructure/Persistence/Mappers/ContentTypeMapper.cs index 48fab6bda1..a8ab98ad69 100644 --- a/src/Umbraco.Infrastructure/Persistence/Mappers/ContentTypeMapper.cs +++ b/src/Umbraco.Infrastructure/Persistence/Mappers/ContentTypeMapper.cs @@ -32,7 +32,7 @@ public sealed class ContentTypeMapper : BaseMapper DefineMap(nameof(ContentType.AllowedAsRoot), nameof(ContentTypeDto.AllowAtRoot)); DefineMap(nameof(ContentType.Description), nameof(ContentTypeDto.Description)); DefineMap(nameof(ContentType.Icon), nameof(ContentTypeDto.Icon)); - DefineMap(nameof(ContentType.IsContainer), nameof(ContentTypeDto.IsContainer)); + DefineMap(nameof(ContentType.ListView), nameof(ContentTypeDto.ListView)); DefineMap(nameof(ContentType.IsElement), nameof(ContentTypeDto.IsElement)); DefineMap(nameof(ContentType.Thumbnail), nameof(ContentTypeDto.Thumbnail)); } diff --git a/src/Umbraco.Infrastructure/Persistence/Mappers/MediaTypeMapper.cs b/src/Umbraco.Infrastructure/Persistence/Mappers/MediaTypeMapper.cs index 47f6d2b7b6..4aca6b01aa 100644 --- a/src/Umbraco.Infrastructure/Persistence/Mappers/MediaTypeMapper.cs +++ b/src/Umbraco.Infrastructure/Persistence/Mappers/MediaTypeMapper.cs @@ -32,7 +32,7 @@ public sealed class MediaTypeMapper : BaseMapper DefineMap(nameof(MediaType.AllowedAsRoot), nameof(ContentTypeDto.AllowAtRoot)); DefineMap(nameof(MediaType.Description), nameof(ContentTypeDto.Description)); DefineMap(nameof(MediaType.Icon), nameof(ContentTypeDto.Icon)); - DefineMap(nameof(MediaType.IsContainer), nameof(ContentTypeDto.IsContainer)); + DefineMap(nameof(MediaType.ListView), nameof(ContentTypeDto.ListView)); DefineMap(nameof(MediaType.IsElement), nameof(ContentTypeDto.IsElement)); DefineMap(nameof(MediaType.Thumbnail), nameof(ContentTypeDto.Thumbnail)); } diff --git a/src/Umbraco.Infrastructure/Persistence/Mappers/MemberTypeMapper.cs b/src/Umbraco.Infrastructure/Persistence/Mappers/MemberTypeMapper.cs index b1f4c1d2e9..8e1cdcf396 100644 --- a/src/Umbraco.Infrastructure/Persistence/Mappers/MemberTypeMapper.cs +++ b/src/Umbraco.Infrastructure/Persistence/Mappers/MemberTypeMapper.cs @@ -32,7 +32,7 @@ public sealed class MemberTypeMapper : BaseMapper DefineMap(nameof(MemberType.AllowedAsRoot), nameof(ContentTypeDto.AllowAtRoot)); DefineMap(nameof(MemberType.Description), nameof(ContentTypeDto.Description)); DefineMap(nameof(MemberType.Icon), nameof(ContentTypeDto.Icon)); - DefineMap(nameof(MemberType.IsContainer), nameof(ContentTypeDto.IsContainer)); + DefineMap(nameof(MemberType.ListView), nameof(ContentTypeDto.ListView)); DefineMap(nameof(MemberType.IsElement), nameof(ContentTypeDto.IsElement)); DefineMap(nameof(MemberType.Thumbnail), nameof(ContentTypeDto.Thumbnail)); } diff --git a/src/Umbraco.Infrastructure/Persistence/Mappers/SimpleContentTypeMapper.cs b/src/Umbraco.Infrastructure/Persistence/Mappers/SimpleContentTypeMapper.cs index 2024ad7622..d1567624a6 100644 --- a/src/Umbraco.Infrastructure/Persistence/Mappers/SimpleContentTypeMapper.cs +++ b/src/Umbraco.Infrastructure/Persistence/Mappers/SimpleContentTypeMapper.cs @@ -26,7 +26,7 @@ public sealed class SimpleContentTypeMapper : BaseMapper DefineMap(nameof(ContentType.Name), nameof(NodeDto.Text)); DefineMap(nameof(ContentType.Alias), nameof(ContentTypeDto.Alias)); DefineMap(nameof(ContentType.Icon), nameof(ContentTypeDto.Icon)); - DefineMap(nameof(ContentType.IsContainer), nameof(ContentTypeDto.IsContainer)); + DefineMap(nameof(ContentType.ListView), nameof(ContentTypeDto.ListView)); DefineMap(nameof(ContentType.AllowedAsRoot), nameof(ContentTypeDto.AllowAtRoot)); DefineMap(nameof(ContentType.IsElement), nameof(ContentTypeDto.IsElement)); } diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs index f1b205b3aa..5c51889488 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs @@ -1510,8 +1510,7 @@ WHERE cmsContentType." + aliasColumn + @" LIKE @pattern", var sql = new Sql( $@"SELECT COUNT(*) FROM cmsContentType INNER JOIN {Constants.DatabaseSchema.Tables.Content} ON cmsContentType.nodeId={Constants.DatabaseSchema.Tables.Content}.contentTypeId -WHERE {Constants.DatabaseSchema.Tables.Content}.nodeId IN (@ids) AND cmsContentType.isContainer=@isContainer", - new { ids, isContainer = true }); +WHERE {Constants.DatabaseSchema.Tables.Content}.nodeId IN (@ids) AND cmsContentType.listView IS NULL", new { ids}); return Database.ExecuteScalar(sql) > 0; } diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DataTypeRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DataTypeRepository.cs index 94b1d06ede..28e9385811 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DataTypeRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DataTypeRepository.cs @@ -149,7 +149,7 @@ internal class DataTypeRepository : EntityRepositoryBase, IDataT .Select(ct => ct.Select(node => node.NodeDto)) .From() .InnerJoin().On(n => n.NodeId, ct => ct.NodeId) - .Where(ct => ct.IsContainer == true); + .Where(ct => ct.ListView != null); List ctds = Database.Fetch(sql); diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/EntityRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/EntityRepository.cs index e8bf7059e6..ff3c929463 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/EntityRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/EntityRepository.cs @@ -460,7 +460,11 @@ internal class EntityRepository : RepositoryBase, IEntityRepositoryExtended { sql .AndSelect(x => Alias(x.Id, "versionId"), x => x.VersionDate) - .AndSelect(x => x.Alias, x => x.Icon, x => x.Thumbnail, x => x.IsContainer, + .AndSelect( + x => x.Alias, + x => x.Icon, + x => x.Thumbnail, + x => x.ListView, x => x.Variations); } @@ -589,7 +593,11 @@ internal class EntityRepository : RepositoryBase, IEntityRepositoryExtended { sql .AndBy(x => x.Id, x => x.VersionDate) - .AndBy(x => x.Alias, x => x.Icon, x => x.Thumbnail, x => x.IsContainer, + .AndBy( + x => x.Alias, + x => x.Icon, + x => x.Thumbnail, + x => x.ListView, x => x.Variations); } diff --git a/src/Umbraco.Infrastructure/Services/ContentListViewServiceBase.cs b/src/Umbraco.Infrastructure/Services/ContentListViewServiceBase.cs index eb02083899..7857051cb6 100644 --- a/src/Umbraco.Infrastructure/Services/ContentListViewServiceBase.cs +++ b/src/Umbraco.Infrastructure/Services/ContentListViewServiceBase.cs @@ -189,7 +189,7 @@ internal abstract class ContentListViewServiceBase> GetListViewConfigurationFromContentTypeAsync(TContentType? contentType) { - if (contentType?.IsContainer == false) + if (contentType?.ListView is null) { return Attempt.FailWithStatus(ContentCollectionOperationStatus.ContentNotCollection, null); } diff --git a/src/Umbraco.Web.BackOffice/Mapping/ContentMapDefinition.cs b/src/Umbraco.Web.BackOffice/Mapping/ContentMapDefinition.cs index 0bc4e9c1b7..8492399e5b 100644 --- a/src/Umbraco.Web.BackOffice/Mapping/ContentMapDefinition.cs +++ b/src/Umbraco.Web.BackOffice/Mapping/ContentMapDefinition.cs @@ -283,7 +283,7 @@ internal class ContentMapDefinition : IMapDefinition target.Id = source.Id; target.IsBlueprint = source.Blueprint; target.IsChildOfListView = DetermineIsChildOfListView(source, parent, context); - target.IsContainer = source.ContentType.IsContainer; + target.IsContainer = source.ContentType.ListView is not null; target.IsElement = source.ContentType.IsElement; target.Key = source.Key; target.Owner = _commonMapper.GetOwner(source, context); @@ -542,7 +542,7 @@ internal class ContentMapDefinition : IMapDefinition } } - return parent.ContentType.IsContainer || _contentTypeService.HasContainerInPath(pathParts.ToArray()); + return parent.ContentType.ListView is not null || _contentTypeService.HasContainerInPath(pathParts.ToArray()); } diff --git a/src/Umbraco.Web.BackOffice/Mapping/MediaMapDefinition.cs b/src/Umbraco.Web.BackOffice/Mapping/MediaMapDefinition.cs index 681017aed1..11dbd462fd 100644 --- a/src/Umbraco.Web.BackOffice/Mapping/MediaMapDefinition.cs +++ b/src/Umbraco.Web.BackOffice/Mapping/MediaMapDefinition.cs @@ -110,6 +110,6 @@ public class MediaMapDefinition : IMapDefinition { // map the IsChildOfListView (this is actually if it is a descendant of a list view!) IMedia? parent = _mediaService.GetParent(source); - return parent != null && (parent.ContentType.IsContainer || _mediaTypeService.HasContainerInPath(parent.Path)); + return parent != null && (parent.ContentType.ListView is not null || _mediaTypeService.HasContainerInPath(parent.Path)); } } diff --git a/tests/Umbraco.TestData/LoadTestController.cs b/tests/Umbraco.TestData/LoadTestController.cs index c957427d18..20ad1b5dfc 100644 --- a/tests/Umbraco.TestData/LoadTestController.cs +++ b/tests/Umbraco.TestData/LoadTestController.cs @@ -214,7 +214,7 @@ public class LoadTestController : Controller Description = "Container for LoadTest content", Icon = "icon-document", AllowedAsRoot = true, - IsContainer = true + ListView = Constants.DataTypes.Guids.ListViewContentGuid, }; containerType.AllowedContentTypes = containerType.AllowedContentTypes.Union(new[] { diff --git a/tests/Umbraco.Tests.Common/Builders/ContentTypeBaseBuilder.cs b/tests/Umbraco.Tests.Common/Builders/ContentTypeBaseBuilder.cs index 3193358b36..a5d3597662 100644 --- a/tests/Umbraco.Tests.Common/Builders/ContentTypeBaseBuilder.cs +++ b/tests/Umbraco.Tests.Common/Builders/ContentTypeBaseBuilder.cs @@ -38,7 +38,7 @@ public abstract class ContentTypeBaseBuilder private string _description; private string _icon; private int? _id; - private bool? _isContainer; + private Guid? _listView; private Guid? _key; private int? _level; private string _name; @@ -94,10 +94,10 @@ public abstract class ContentTypeBaseBuilder set => _id = value; } - bool? IWithIsContainerBuilder.IsContainer + Guid? IWithIsContainerBuilder.ListView { - get => _isContainer; - set => _isContainer = value; + get => _listView; + set => _listView = value; } Guid? IWithKeyBuilder.Key @@ -200,7 +200,7 @@ public abstract class ContentTypeBaseBuilder protected bool GetTrashed() => _trashed ?? false; - protected bool GetIsContainer() => _isContainer ?? false; + protected Guid? GetListView() => _listView; protected void BuildPropertyGroups(ContentTypeCompositionBase contentType, IEnumerable propertyGroups) { diff --git a/tests/Umbraco.Tests.Common/Builders/ContentTypeBuilder.cs b/tests/Umbraco.Tests.Common/Builders/ContentTypeBuilder.cs index a5fcc1fe36..1bb8c6fab9 100644 --- a/tests/Umbraco.Tests.Common/Builders/ContentTypeBuilder.cs +++ b/tests/Umbraco.Tests.Common/Builders/ContentTypeBuilder.cs @@ -123,7 +123,7 @@ public class ContentTypeBuilder contentType.Thumbnail = GetThumbnail(); contentType.CreatorId = GetCreatorId(); contentType.Trashed = GetTrashed(); - contentType.IsContainer = GetIsContainer(); + contentType.ListView = GetListView(); contentType.IsElement = _isElement ?? false; contentType.HistoryCleanup = new HistoryCleanup(); diff --git a/tests/Umbraco.Tests.Common/Builders/Extensions/BuilderExtensions.cs b/tests/Umbraco.Tests.Common/Builders/Extensions/BuilderExtensions.cs index e531c22963..1a4660ed64 100644 --- a/tests/Umbraco.Tests.Common/Builders/Extensions/BuilderExtensions.cs +++ b/tests/Umbraco.Tests.Common/Builders/Extensions/BuilderExtensions.cs @@ -205,10 +205,10 @@ public static class BuilderExtensions return builder; } - public static T WithIsContainer(this T builder, bool isContainer) + public static T WithIsContainer(this T builder, Guid? listView) where T : IWithIsContainerBuilder { - builder.IsContainer = isContainer; + builder.ListView = listView; return builder; } diff --git a/tests/Umbraco.Tests.Common/Builders/Interfaces/IWithIsContainerBuilder.cs b/tests/Umbraco.Tests.Common/Builders/Interfaces/IWithIsContainerBuilder.cs index 30fc33cde4..619698ced9 100644 --- a/tests/Umbraco.Tests.Common/Builders/Interfaces/IWithIsContainerBuilder.cs +++ b/tests/Umbraco.Tests.Common/Builders/Interfaces/IWithIsContainerBuilder.cs @@ -5,5 +5,5 @@ namespace Umbraco.Cms.Tests.Common.Builders.Interfaces; public interface IWithIsContainerBuilder { - bool? IsContainer { get; set; } + Guid? ListView { get; set; } } diff --git a/tests/Umbraco.Tests.Common/Builders/MediaTypeBuilder.cs b/tests/Umbraco.Tests.Common/Builders/MediaTypeBuilder.cs index d4ab24472a..dcde82b47d 100644 --- a/tests/Umbraco.Tests.Common/Builders/MediaTypeBuilder.cs +++ b/tests/Umbraco.Tests.Common/Builders/MediaTypeBuilder.cs @@ -117,7 +117,7 @@ public class MediaTypeBuilder mediaType.Thumbnail = GetThumbnail(); mediaType.CreatorId = GetCreatorId(); mediaType.Trashed = GetTrashed(); - mediaType.IsContainer = GetIsContainer(); + mediaType.ListView = GetListView(); BuildPropertyGroups(mediaType, _propertyGroupBuilders.Select(x => x.Build())); BuildPropertyTypeIds(mediaType, _propertyTypeIdsIncrementingFrom); diff --git a/tests/Umbraco.Tests.Common/Builders/MemberTypeBuilder.cs b/tests/Umbraco.Tests.Common/Builders/MemberTypeBuilder.cs index 817d0be203..3209d633ab 100644 --- a/tests/Umbraco.Tests.Common/Builders/MemberTypeBuilder.cs +++ b/tests/Umbraco.Tests.Common/Builders/MemberTypeBuilder.cs @@ -87,7 +87,7 @@ public class MemberTypeBuilder Thumbnail = GetThumbnail(), CreatorId = GetCreatorId(), Trashed = GetTrashed(), - IsContainer = GetIsContainer() + ListView = GetListView(), }; BuildPropertyGroups(memberType, _propertyGroupBuilders.Select(x => x.Build())); diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Core/Mapping/ContentTypeModelMappingTests.cs b/tests/Umbraco.Tests.Integration/Umbraco.Core/Mapping/ContentTypeModelMappingTests.cs index f47d2f1c0d..1f2adfb96a 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Core/Mapping/ContentTypeModelMappingTests.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Core/Mapping/ContentTypeModelMappingTests.cs @@ -60,7 +60,7 @@ public class ContentTypeModelMappingTests : UmbracoIntegrationTest Assert.AreEqual(display.ParentId, result.ParentId); Assert.AreEqual(display.Path, result.Path); Assert.AreEqual(display.Thumbnail, result.Thumbnail); - Assert.AreEqual(display.IsContainer, result.IsContainer); + Assert.AreEqual(display.ListView, result.ListView); Assert.AreEqual(display.AllowAsRoot, result.AllowedAsRoot); Assert.AreEqual(display.CreateDate, result.CreateDate); Assert.AreEqual(display.UpdateDate, result.UpdateDate); @@ -106,7 +106,7 @@ public class ContentTypeModelMappingTests : UmbracoIntegrationTest Assert.AreEqual(display.ParentId, result.ParentId); Assert.AreEqual(display.Path, result.Path); Assert.AreEqual(display.Thumbnail, result.Thumbnail); - Assert.AreEqual(display.IsContainer, result.IsContainer); + Assert.AreEqual(display.ListView, result.ListView); Assert.AreEqual(display.AllowAsRoot, result.AllowedAsRoot); Assert.AreEqual(display.CreateDate, result.CreateDate); Assert.AreEqual(display.UpdateDate, result.UpdateDate); @@ -163,7 +163,7 @@ public class ContentTypeModelMappingTests : UmbracoIntegrationTest Assert.AreEqual(display.ParentId, result.ParentId); Assert.AreEqual(display.Path, result.Path); Assert.AreEqual(display.Thumbnail, result.Thumbnail); - Assert.AreEqual(display.IsContainer, result.IsContainer); + Assert.AreEqual(display.ListView, result.ListView); Assert.AreEqual(display.AllowAsRoot, result.AllowedAsRoot); Assert.AreEqual(display.CreateDate, result.CreateDate); Assert.AreEqual(display.UpdateDate, result.UpdateDate); @@ -256,7 +256,7 @@ public class ContentTypeModelMappingTests : UmbracoIntegrationTest Assert.AreEqual(memberType.ParentId, result.ParentId); Assert.AreEqual(memberType.Path, result.Path); Assert.AreEqual(memberType.Thumbnail, result.Thumbnail); - Assert.AreEqual(memberType.IsContainer, result.IsContainer); + Assert.AreEqual(memberType.ListView, result.ListView); Assert.AreEqual(memberType.CreateDate, result.CreateDate); Assert.AreEqual(memberType.UpdateDate, result.UpdateDate); @@ -300,7 +300,7 @@ public class ContentTypeModelMappingTests : UmbracoIntegrationTest Assert.AreEqual(mediaType.ParentId, result.ParentId); Assert.AreEqual(mediaType.Path, result.Path); Assert.AreEqual(mediaType.Thumbnail, result.Thumbnail); - Assert.AreEqual(mediaType.IsContainer, result.IsContainer); + Assert.AreEqual(mediaType.ListView, result.ListView); Assert.AreEqual(mediaType.CreateDate, result.CreateDate); Assert.AreEqual(mediaType.UpdateDate, result.UpdateDate); @@ -345,7 +345,7 @@ public class ContentTypeModelMappingTests : UmbracoIntegrationTest Assert.AreEqual(contentType.ParentId, result.ParentId); Assert.AreEqual(contentType.Path, result.Path); Assert.AreEqual(contentType.Thumbnail, result.Thumbnail); - Assert.AreEqual(contentType.IsContainer, result.IsContainer); + Assert.AreEqual(contentType.ListView, result.ListView); Assert.AreEqual(contentType.CreateDate, result.CreateDate); Assert.AreEqual(contentType.UpdateDate, result.UpdateDate); Assert.AreEqual(contentType.DefaultTemplate.Alias, result.DefaultTemplate.Alias); @@ -629,7 +629,7 @@ public class ContentTypeModelMappingTests : UmbracoIntegrationTest Assert.AreEqual(contentType.ParentId, result.ParentId); Assert.AreEqual(contentType.Path, result.Path); Assert.AreEqual(contentType.Thumbnail, result.Thumbnail); - Assert.AreEqual(contentType.IsContainer, result.IsContainer); + Assert.AreEqual(contentType.ListView, result.ListView); Assert.AreEqual(contentType.CreateDate, result.CreateDate); Assert.AreEqual(contentType.UpdateDate, result.UpdateDate); @@ -711,7 +711,7 @@ public class ContentTypeModelMappingTests : UmbracoIntegrationTest Assert.AreEqual(contentType.ParentId, result.ParentId); Assert.AreEqual(contentType.Path, result.Path); Assert.AreEqual(contentType.Thumbnail, result.Thumbnail); - Assert.AreEqual(contentType.IsContainer, result.IsContainer); + Assert.AreEqual(contentType.ListView, result.ListView); Assert.AreEqual(contentType.CreateDate, result.CreateDate); Assert.AreEqual(contentType.UpdateDate, result.UpdateDate); Assert.AreEqual(contentType.DefaultTemplate.Alias, result.DefaultTemplate.Alias); @@ -818,7 +818,7 @@ public class ContentTypeModelMappingTests : UmbracoIntegrationTest Path = "-1,1234", ParentId = -1, Thumbnail = "tree-thumb", - IsContainer = true, + ListView = Constants.DataTypes.Guids.ListViewMembersGuid, Groups = new[] { new PropertyGroupBasic @@ -865,7 +865,7 @@ public class ContentTypeModelMappingTests : UmbracoIntegrationTest Path = "-1,1234", ParentId = -1, Thumbnail = "tree-thumb", - IsContainer = true, + ListView = Constants.DataTypes.Guids.ListViewMembersGuid, Groups = new[] { new PropertyGroupBasic @@ -908,7 +908,7 @@ public class ContentTypeModelMappingTests : UmbracoIntegrationTest Path = "-1,1234", ParentId = -1, Thumbnail = "tree-thumb", - IsContainer = true, + ListView = Constants.DataTypes.Guids.ListViewMembersGuid, Groups = new[] { new PropertyGroupBasic @@ -953,7 +953,7 @@ public class ContentTypeModelMappingTests : UmbracoIntegrationTest Path = "-1,1234", ParentId = -1, Thumbnail = "tree-thumb", - IsContainer = true, + ListView = Constants.DataTypes.Guids.ListViewMembersGuid, Groups = new[] { new PropertyGroupBasic @@ -1019,7 +1019,7 @@ public class ContentTypeModelMappingTests : UmbracoIntegrationTest Path = "-1,1234", ParentId = -1, Thumbnail = "tree-thumb", - IsContainer = true, + ListView = Constants.DataTypes.Guids.ListViewMembersGuid, Groups = new[] { new PropertyGroupBasic diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/ContentTypeRepositoryTest.cs b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/ContentTypeRepositoryTest.cs index bfa9e0c75a..caa12f74f4 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/ContentTypeRepositoryTest.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/ContentTypeRepositoryTest.cs @@ -405,7 +405,7 @@ public class ContentTypeRepositoryTest : UmbracoIntegrationTest // ContentTypeSave CompositeContentTypes = display.CompositeContentTypes, - IsContainer = display.IsContainer, + ListView = display.ListView, AllowAsRoot = display.AllowAsRoot, AllowedTemplates = display.AllowedTemplates.Select(x => x.Alias), AllowedContentTypes = display.AllowedContentTypes, diff --git a/tests/Umbraco.Tests.UnitTests/Umbraco.Core/Models/ContentTypeTests.cs b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/Models/ContentTypeTests.cs index abd384a19a..3ca6fd794d 100644 --- a/tests/Umbraco.Tests.UnitTests/Umbraco.Core/Models/ContentTypeTests.cs +++ b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/Models/ContentTypeTests.cs @@ -146,7 +146,7 @@ public class ContentTypeTests Assert.AreEqual(clone.UpdateDate, contentType.UpdateDate); Assert.AreEqual(clone.Thumbnail, contentType.Thumbnail); Assert.AreEqual(clone.Icon, contentType.Icon); - Assert.AreEqual(clone.IsContainer, contentType.IsContainer); + Assert.AreEqual(clone.ListView, contentType.ListView); // This double verifies by reflection var allProps = clone.GetType().GetProperties(); @@ -225,7 +225,7 @@ public class ContentTypeTests Assert.AreEqual(clone.UpdateDate, contentType.UpdateDate); Assert.AreEqual(clone.Thumbnail, contentType.Thumbnail); Assert.AreEqual(clone.Icon, contentType.Icon); - Assert.AreEqual(clone.IsContainer, contentType.IsContainer); + Assert.AreEqual(clone.ListView, contentType.ListView); // This double verifies by reflection var allProps = clone.GetType().GetProperties(); @@ -288,7 +288,7 @@ public class ContentTypeTests Assert.AreEqual(clone.UpdateDate, contentType.UpdateDate); Assert.AreEqual(clone.Thumbnail, contentType.Thumbnail); Assert.AreEqual(clone.Icon, contentType.Icon); - Assert.AreEqual(clone.IsContainer, contentType.IsContainer); + Assert.AreEqual(clone.ListView, contentType.ListView); // This double verifies by reflection var allProps = clone.GetType().GetProperties(); diff --git a/tests/Umbraco.Tests.UnitTests/Umbraco.Tests.Common/Builders/ContentTypeBuilderTests.cs b/tests/Umbraco.Tests.UnitTests/Umbraco.Tests.Common/Builders/ContentTypeBuilderTests.cs index e6313fd081..eceebc2c88 100644 --- a/tests/Umbraco.Tests.UnitTests/Umbraco.Tests.Common/Builders/ContentTypeBuilderTests.cs +++ b/tests/Umbraco.Tests.UnitTests/Umbraco.Tests.Common/Builders/ContentTypeBuilderTests.cs @@ -118,7 +118,7 @@ public class ContentTypeBuilderTests Assert.AreEqual(testIcon, contentType.Icon); Assert.AreEqual(testThumbnail, contentType.Thumbnail); Assert.AreEqual(testTrashed, contentType.Trashed); - Assert.IsFalse(contentType.IsContainer); + Assert.IsNull(contentType.ListView); Assert.AreEqual(2, contentType.PropertyTypes.Count()); var propertyTypeIds = contentType.PropertyTypes.Select(x => x.Id).OrderBy(x => x).ToArray(); diff --git a/tests/Umbraco.Tests.UnitTests/Umbraco.Tests.Common/Builders/MediaTypeBuilderTests.cs b/tests/Umbraco.Tests.UnitTests/Umbraco.Tests.Common/Builders/MediaTypeBuilderTests.cs index 36cd29bee9..4a02c8c9c0 100644 --- a/tests/Umbraco.Tests.UnitTests/Umbraco.Tests.Common/Builders/MediaTypeBuilderTests.cs +++ b/tests/Umbraco.Tests.UnitTests/Umbraco.Tests.Common/Builders/MediaTypeBuilderTests.cs @@ -99,7 +99,7 @@ public class MediaTypeBuilderTests Assert.AreEqual(testIcon, mediaType.Icon); Assert.AreEqual(testThumbnail, mediaType.Thumbnail); Assert.AreEqual(testTrashed, mediaType.Trashed); - Assert.IsFalse(mediaType.IsContainer); + Assert.IsNull(mediaType.ListView); Assert.AreEqual(7, mediaType.PropertyTypes.Count()); // 5 from media properties group, 2 custom var propertyTypeIds = mediaType.PropertyTypes.Select(x => x.Id).OrderBy(x => x).ToArray(); diff --git a/tests/Umbraco.Tests.UnitTests/Umbraco.Tests.Common/Builders/MemberTypeBuilderTests.cs b/tests/Umbraco.Tests.UnitTests/Umbraco.Tests.Common/Builders/MemberTypeBuilderTests.cs index dcc61d59ff..6ec33489bd 100644 --- a/tests/Umbraco.Tests.UnitTests/Umbraco.Tests.Common/Builders/MemberTypeBuilderTests.cs +++ b/tests/Umbraco.Tests.UnitTests/Umbraco.Tests.Common/Builders/MemberTypeBuilderTests.cs @@ -100,7 +100,7 @@ public class MemberTypeBuilderTests Assert.AreEqual(testIcon, memberType.Icon); Assert.AreEqual(testThumbnail, memberType.Thumbnail); Assert.AreEqual(testTrashed, memberType.Trashed); - Assert.IsFalse(memberType.IsContainer); + Assert.IsNull(memberType.ListView); Assert.AreEqual(3, memberType.PropertyTypes.Count()); // 1 from membership properties group, 2 custom var propertyTypeIds = memberType.PropertyTypes.Select(x => x.Id).OrderBy(x => x).ToArray();