From 68c26e90a75f363652aa07fb660e4be1d660853d Mon Sep 17 00:00:00 2001 From: Ronald Barendse Date: Thu, 15 Jul 2021 14:14:08 +0200 Subject: [PATCH] Update ContentTypeSave validation to use alias --- src/Umbraco.Web/Models/ContentEditing/ContentTypeSave.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web/Models/ContentEditing/ContentTypeSave.cs b/src/Umbraco.Web/Models/ContentEditing/ContentTypeSave.cs index 0579849d2e..6a8746292f 100644 --- a/src/Umbraco.Web/Models/ContentEditing/ContentTypeSave.cs +++ b/src/Umbraco.Web/Models/ContentEditing/ContentTypeSave.cs @@ -43,7 +43,7 @@ namespace Umbraco.Web.Models.ContentEditing public virtual IEnumerable Validate(ValidationContext validationContext) { if (CompositeContentTypes.Any(x => x.IsNullOrWhiteSpace())) - yield return new ValidationResult("Composite Content Type value cannot be null", new[] {"CompositeContentTypes"}); + yield return new ValidationResult("Composite Content Type value cannot be null", new[] { "CompositeContentTypes" }); } } @@ -88,13 +88,14 @@ namespace Umbraco.Web.Models.ContentEditing yield return validationResult; } - var duplicateGroups = Groups.GroupBy(x => x.Name?.ToUpperInvariant()).Where(x => x.Count() > 1).ToArray(); + var duplicateGroups = Groups.GroupBy(x => x.Alias).Where(x => x.Count() > 1).ToArray(); if (duplicateGroups.Any()) { //we need to return the field name with an index so it's wired up correctly var lastIndex = Groups.IndexOf(duplicateGroups.Last().Last()); - yield return new ValidationResult("Duplicate group names not allowed", new[] + yield return new ValidationResult("Duplicate group aliases not allowed", new[] { + // TODO We don't display the alias yet, so add the validation message to the name string.Format("Groups[{0}].Name", lastIndex) }); }