From 89de08a1e8ca3ce03553a640a834c1a846f7f206 Mon Sep 17 00:00:00 2001 From: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com> Date: Fri, 12 Apr 2024 10:58:26 +0200 Subject: [PATCH] V14: Remove member list view (#15979) * Remove default member list view * Fix up test --------- Co-authored-by: nikolajlauridsen --- .../ConfigurationDataTypeController.cs | 1 - .../DatatypeConfigurationResponseModel.cs | 2 -- src/Umbraco.Core/Constants-DataTypes.cs | 5 ----- src/Umbraco.Core/Models/DataTypeExtensions.cs | 2 -- .../Migrations/Install/DatabaseDataCreator.cs | 19 ------------------- .../AddListViewKeysToDocumentTypes.cs | 5 ----- .../V_14_0_0/MigrateDataTypeConfigurations.cs | 8 +++----- .../DataTypeDefinitionRepositoryTest.cs | 2 +- .../Services/DataTypeServiceTests.cs | 1 - 9 files changed, 4 insertions(+), 41 deletions(-) diff --git a/src/Umbraco.Cms.Api.Management/Controllers/DataType/ConfigurationDataTypeController.cs b/src/Umbraco.Cms.Api.Management/Controllers/DataType/ConfigurationDataTypeController.cs index 3f6f7c54fe..f0039b94d6 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/DataType/ConfigurationDataTypeController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/DataType/ConfigurationDataTypeController.cs @@ -25,7 +25,6 @@ public class ConfigurationDataTypeController : DataTypeControllerBase CanBeChanged = _dataTypesSettings.CanBeChanged, DocumentListViewId = Constants.DataTypes.Guids.ListViewContentGuid, MediaListViewId = Constants.DataTypes.Guids.ListViewMediaGuid, - MemberListViewId = Constants.DataTypes.Guids.ListViewMembersGuid, }; return Task.FromResult(Ok(responseModel)); } diff --git a/src/Umbraco.Cms.Api.Management/ViewModels/DataType/DatatypeConfigurationResponseModel.cs b/src/Umbraco.Cms.Api.Management/ViewModels/DataType/DatatypeConfigurationResponseModel.cs index cf8cc2ef58..b7150ddccc 100644 --- a/src/Umbraco.Cms.Api.Management/ViewModels/DataType/DatatypeConfigurationResponseModel.cs +++ b/src/Umbraco.Cms.Api.Management/ViewModels/DataType/DatatypeConfigurationResponseModel.cs @@ -9,6 +9,4 @@ public class DatatypeConfigurationResponseModel public required Guid DocumentListViewId { get; init; } public required Guid MediaListViewId { get; init; } - - public required Guid MemberListViewId { get; init; } } diff --git a/src/Umbraco.Core/Constants-DataTypes.cs b/src/Umbraco.Core/Constants-DataTypes.cs index d25a34e166..947899bee7 100644 --- a/src/Umbraco.Core/Constants-DataTypes.cs +++ b/src/Umbraco.Core/Constants-DataTypes.cs @@ -284,11 +284,6 @@ public static partial class Constants /// public static readonly Guid ListViewMediaGuid = new(ListViewMedia); - /// - /// Guid for List View - Members - /// - public static readonly Guid ListViewMembersGuid = new(ListViewMembers); - /// /// Guid for Date Picker with time /// diff --git a/src/Umbraco.Core/Models/DataTypeExtensions.cs b/src/Umbraco.Core/Models/DataTypeExtensions.cs index 568dede982..671c0e83fc 100644 --- a/src/Umbraco.Core/Models/DataTypeExtensions.cs +++ b/src/Umbraco.Core/Models/DataTypeExtensions.cs @@ -18,7 +18,6 @@ public static class DataTypeExtensions Constants.DataTypes.Guids.TagsGuid, Constants.DataTypes.Guids.ListViewContentGuid, Constants.DataTypes.Guids.ListViewMediaGuid, - Constants.DataTypes.Guids.ListViewMembersGuid, Constants.DataTypes.Guids.DatePickerWithTimeGuid, Constants.DataTypes.Guids.ApprovedColorGuid, Constants.DataTypes.Guids.DropdownMultipleGuid, @@ -56,7 +55,6 @@ public static class DataTypeExtensions // these data types are required for default list view handling Constants.DataTypes.Guids.ListViewContentGuid, Constants.DataTypes.Guids.ListViewMediaGuid, - Constants.DataTypes.Guids.ListViewMembersGuid, }; /// diff --git a/src/Umbraco.Infrastructure/Migrations/Install/DatabaseDataCreator.cs b/src/Umbraco.Infrastructure/Migrations/Install/DatabaseDataCreator.cs index a7a0b38b49..b56d8ae808 100644 --- a/src/Umbraco.Infrastructure/Migrations/Install/DatabaseDataCreator.cs +++ b/src/Umbraco.Infrastructure/Migrations/Install/DatabaseDataCreator.cs @@ -674,25 +674,6 @@ internal class DatabaseDataCreator }, Constants.DatabaseSchema.Tables.Node, "id"); - ConditionalInsert( - Constants.Configuration.NamedOptions.InstallDefaultData.DataTypes, - Constants.DataTypes.Guids.ListViewMembers, - new NodeDto - { - NodeId = Constants.DataTypes.DefaultMembersListView, - Trashed = false, - ParentId = -1, - UserId = -1, - Level = 1, - Path = $"-1,{Constants.DataTypes.DefaultMembersListView}", - SortOrder = 2, - UniqueId = Constants.DataTypes.Guids.ListViewMembersGuid, - Text = Constants.Conventions.DataTypes.ListViewPrefix + "Members", - NodeObjectType = Constants.ObjectTypes.DataType, - CreateDate = DateTime.Now, - }, - Constants.DatabaseSchema.Tables.Node, - "id"); ConditionalInsert( Constants.Configuration.NamedOptions.InstallDefaultData.DataTypes, Constants.DataTypes.Guids.Tags, 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 index 7320d733cc..de54432c73 100644 --- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_14_0_0/AddListViewKeysToDocumentTypes.cs +++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_14_0_0/AddListViewKeysToDocumentTypes.cs @@ -115,11 +115,6 @@ public class AddListViewKeysToDocumentTypes : UnscopedMigrationBase 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; } diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_14_0_0/MigrateDataTypeConfigurations.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_14_0_0/MigrateDataTypeConfigurations.cs index f9542f7d47..c0113ee9db 100644 --- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_14_0_0/MigrateDataTypeConfigurations.cs +++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_14_0_0/MigrateDataTypeConfigurations.cs @@ -93,7 +93,7 @@ public class MigrateDataTypeConfigurations : MigrationBase PropertyEditorAliases.DropDownListFlexible => HandleDropDown(ref configurationData), PropertyEditorAliases.EmailAddress => HandleEmailAddress(ref configurationData), PropertyEditorAliases.Label => HandleLabel(ref configurationData), - PropertyEditorAliases.ListView => HandleListView(ref configurationData, dataTypeDto.NodeDto?.UniqueId, allMediaTypes, allMemberTypes), + PropertyEditorAliases.ListView => HandleListView(ref configurationData, dataTypeDto.NodeDto?.UniqueId, allMediaTypes), PropertyEditorAliases.MediaPicker3 => HandleMediaPicker(ref configurationData, allMediaTypes), PropertyEditorAliases.MultiNodeTreePicker => HandleMultiNodeTreePicker(ref configurationData, allContentTypes, allMediaTypes, allMemberTypes), PropertyEditorAliases.MultiUrlPicker => HandleMultiUrlPicker(ref configurationData), @@ -308,13 +308,11 @@ public class MigrateDataTypeConfigurations : MigrationBase // ensure that list view configs have all configurations, as some have never been added by means of migration. // also performs a re-formatting of "layouts" and "includeProperties" to a V14 format - private bool HandleListView(ref Dictionary configurationData, Guid? dataTypeKey, IMediaType[] allMediaTypes, IMemberType[] allMemberTypes) + private bool HandleListView(ref Dictionary configurationData, Guid? dataTypeKey, IMediaType[] allMediaTypes) { var collectionViewType = dataTypeKey == Constants.DataTypes.Guids.ListViewMediaGuid || allMediaTypes.Any(mt => mt.ListView == dataTypeKey) ? "Media" - : dataTypeKey == Constants.DataTypes.Guids.ListViewMembersGuid || allMemberTypes.Any(mt => mt.ListView == dataTypeKey) - ? "Member" - : "Document"; + : "Document"; string? LayoutPathToCollectionView(string? path) => "views/propertyeditors/listview/layouts/list/list.html".InvariantEquals(path) diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs index ceacdd8091..60c175b070 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs @@ -250,7 +250,7 @@ public class DataTypeDefinitionRepositoryTest : UmbracoIntegrationTest Assert.That(dataTypeDefinitions, Is.Not.Null); Assert.That(dataTypeDefinitions.Any(), Is.True); Assert.That(dataTypeDefinitions.Any(x => x == null), Is.False); - Assert.That(dataTypeDefinitions.Length, Is.EqualTo(35)); + Assert.That(dataTypeDefinitions.Length, Is.EqualTo(34)); } } diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/DataTypeServiceTests.cs b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/DataTypeServiceTests.cs index 0c9d514ef6..1c2b46137b 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/DataTypeServiceTests.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/DataTypeServiceTests.cs @@ -437,7 +437,6 @@ public class DataTypeServiceTests : UmbracoIntegrationTest [TestCase(Constants.DataTypes.Guids.Checkbox)] [TestCase(Constants.DataTypes.Guids.ListViewContent)] [TestCase(Constants.DataTypes.Guids.ListViewMedia)] - [TestCase(Constants.DataTypes.Guids.ListViewMembers)] public async Task Cannot_Delete_NonDeletable_DataType(string dataTypeKey) { var dataType = await DataTypeService.GetAsync(Guid.Parse(dataTypeKey));