From ade88757a7437ca7fd2487d1cf1205a85e4b9213 Mon Sep 17 00:00:00 2001 From: Ronald Barendse Date: Wed, 14 Jul 2021 16:23:06 +0200 Subject: [PATCH] Minor cleanup for improved backwards compatibility --- src/Umbraco.Core/Models/PropertyGroupCollection.cs | 7 ++++--- src/Umbraco.Web/Models/ContentEditing/Tab.cs | 3 +-- .../Models/Mapping/ContentPropertyMapDefinition.cs | 2 +- src/Umbraco.Web/Models/Mapping/TabsAndPropertiesMapper.cs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Umbraco.Core/Models/PropertyGroupCollection.cs b/src/Umbraco.Core/Models/PropertyGroupCollection.cs index b6a121b649..b42bb8aaa3 100644 --- a/src/Umbraco.Core/Models/PropertyGroupCollection.cs +++ b/src/Umbraco.Core/Models/PropertyGroupCollection.cs @@ -178,16 +178,17 @@ namespace Umbraco.Core.Models } // TODO Remove this method in v9 (only needed for backwards compatibility with names) - public new bool Contains(string key) => IndexOfKey(key) != -1; + public new bool Contains(string groupName) => IndexOfKey(groupName) != -1; public bool Contains(int id) { return this.Any(x => x.Id == id); } - public void RemoveItem(string key) + [Obsolete("Use Remove(key) instead.")] + public void RemoveItem(string propertyGroupName) { - var index = IndexOfKey(key); + var index = IndexOfKey(propertyGroupName); // Only removes an item if the key was found if (index != -1) diff --git a/src/Umbraco.Web/Models/ContentEditing/Tab.cs b/src/Umbraco.Web/Models/ContentEditing/Tab.cs index a4ec974cc6..9868637052 100644 --- a/src/Umbraco.Web/Models/ContentEditing/Tab.cs +++ b/src/Umbraco.Web/Models/ContentEditing/Tab.cs @@ -17,9 +17,8 @@ namespace Umbraco.Web.Models.ContentEditing [DataMember(Name = "key")] public Guid Key { get; set; } - [Obsolete("A generic tab should not reference property group specific types!")] [DataMember(Name = "type")] - public PropertyGroupType Type { get; set; } + public int Type { get; set; } [DataMember(Name = "active")] public bool IsActive { get; set; } diff --git a/src/Umbraco.Web/Models/Mapping/ContentPropertyMapDefinition.cs b/src/Umbraco.Web/Models/Mapping/ContentPropertyMapDefinition.cs index 75a394584b..4f0f6b0301 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentPropertyMapDefinition.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentPropertyMapDefinition.cs @@ -37,7 +37,7 @@ namespace Umbraco.Web.Models.Mapping { target.Id = source.Id; target.Key = source.Key; - target.Type = source.Type; + target.Type = (int)source.Type; target.Label = source.Name; target.Alias = source.Alias; target.IsActive = true; diff --git a/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesMapper.cs b/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesMapper.cs index b2bdb272e6..65629e9ad9 100644 --- a/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesMapper.cs +++ b/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesMapper.cs @@ -159,7 +159,7 @@ namespace Umbraco.Web.Models.Mapping { Id = g.Id, Key = g.Key, - Type = g.Type, + Type = (int)g.Type, Label = LocalizedTextService.UmbracoDictionaryTranslate(g.Name), Alias = g.Alias, Properties = mappedProperties