From 704fad92e5d7eee1db0c8016f6f104c374ead8b8 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Wed, 20 Jan 2021 10:04:54 +0100 Subject: [PATCH 1/5] Fixes: 9360: Nested validation freezes browser (#9677) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Niels Lyngsø (cherry picked from commit b75a237162d23c16b9090a5819e63eb371b1bb24) --- .../common/services/angularhelper.service.js | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/services/angularhelper.service.js b/src/Umbraco.Web.UI.Client/src/common/services/angularhelper.service.js index fd620bac18..7c291ffb3f 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/angularhelper.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/angularhelper.service.js @@ -11,6 +11,11 @@ function angularHelper($q) { var requiredFormProps = ["$error", "$name", "$dirty", "$pristine", "$valid", "$submitted", "$pending"]; function collectAllFormErrorsRecursively(formCtrl, allErrors) { + // skip if the control is already added to the array + if (allErrors.indexOf(formCtrl) !== -1) { + return; + } + // loop over the error dictionary (see https://docs.angularjs.org/api/ng/type/form.FormController#$error) var keys = Object.keys(formCtrl.$error); if (keys.length === 0) { @@ -31,6 +36,7 @@ function angularHelper($q) { allErrors.push(ctrl); // add the error return; } + // recurse with the sub form collectAllFormErrorsRecursively(ctrl, allErrors); } @@ -43,6 +49,7 @@ function angularHelper($q) { } function isForm(obj) { + // a method to check that the collection of object prop names contains the property name expected function allPropertiesExist(objectPropNames) { //ensure that every required property name exists on the current object @@ -89,9 +96,9 @@ function angularHelper($q) { /** * Method used to re-run the $parsers for a given ngModel - * @param {} scope - * @param {} ngModel - * @returns {} + * @param {} scope + * @param {} ngModel + * @returns {} */ revalidateNgModel: function (scope, ngModel) { this.safeApply(scope, function() { @@ -103,8 +110,8 @@ function angularHelper($q) { /** * Execute a list of promises sequentially. Unlike $q.all which executes all promises at once, this will execute them in sequence. - * @param {} promises - * @returns {} + * @param {} promises + * @returns {} */ executeSequentialPromises: function (promises) { @@ -178,7 +185,7 @@ function angularHelper($q) { //NOTE: There isn't a way in angular to get a reference to the current form object since the form object // is just defined as a property of the scope when it is named but you'll always need to know the name which // isn't very convenient. If we want to watch for validation changes we need to get a form reference. - // The way that we detect the form object is a bit hackerific in that we detect all of the required properties + // The way that we detect the form object is a bit hackerific in that we detect all of the required properties // that exist on a form object. // //The other way to do it in a directive is to require "^form", but in a controller the only other way to do it @@ -239,7 +246,7 @@ function angularHelper($q) { $submitted: false, $pending: undefined, $addControl: Utilities.noop, - $removeControl: Utilities.noop, + $removeControl: Utilities.noop, $setValidity: Utilities.noop, $setDirty: Utilities.noop, $setPristine: Utilities.noop, From 0744b38fe4f8b15e3fdc460261d8e28d24906f65 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Wed, 20 Jan 2021 11:16:28 +0100 Subject: [PATCH 2/5] Fixes umbraco/Umbraco-CMS#9244 Log a warning instead of throwing an error so existing code doesn't fail --- src/Umbraco.Core/Services/Implement/UserService.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Core/Services/Implement/UserService.cs b/src/Umbraco.Core/Services/Implement/UserService.cs index e4906863fa..41424e1dda 100644 --- a/src/Umbraco.Core/Services/Implement/UserService.cs +++ b/src/Umbraco.Core/Services/Implement/UserService.cs @@ -205,7 +205,7 @@ namespace Umbraco.Core.Services.Implement //NOTE: this will not be cached return _userRepository.GetByUsername(username, includeSecurityData: false); } - + throw; } } @@ -258,7 +258,7 @@ namespace Umbraco.Core.Services.Implement // this method must exist in this service as an implementation (legacy) void IMembershipMemberService.SetLastLogin(string username, DateTime date) { - throw new NotSupportedException("This method is not implemented or supported for users"); + Logger.Warn("This method is not implemented. Using membership providers users is not advised, use ASP.NET Identity instead. See issue #9224 for more information."); } /// @@ -717,7 +717,7 @@ namespace Umbraco.Core.Services.Implement //NOTE: this will not be cached return _userRepository.Get(id, includeSecurityData: false); } - + throw; } } From e18bda50a10e94ba5eb870ba65eb36426d3e8bac Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Wed, 20 Jan 2021 11:18:18 +0100 Subject: [PATCH 3/5] Bump version to 8.6.7 --- src/SolutionInfo.cs | 6 +++--- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/SolutionInfo.cs b/src/SolutionInfo.cs index 687030ad13..b5fb5fdd77 100644 --- a/src/SolutionInfo.cs +++ b/src/SolutionInfo.cs @@ -2,7 +2,7 @@ using System.Resources; [assembly: AssemblyCompany("Umbraco")] -[assembly: AssemblyCopyright("Copyright © Umbraco 2020")] +[assembly: AssemblyCopyright("Copyright © Umbraco 2021")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -18,5 +18,5 @@ using System.Resources; [assembly: AssemblyVersion("8.0.0")] // these are FYI and changed automatically -[assembly: AssemblyFileVersion("8.6.6")] -[assembly: AssemblyInformationalVersion("8.6.6")] +[assembly: AssemblyFileVersion("8.6.7")] +[assembly: AssemblyInformationalVersion("8.6.7")] diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index e8c31f4665..bb36aeb8c2 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -345,9 +345,9 @@ False True - 8660 + 8670 / - http://localhost:8660 + http://localhost:8670 False False From b44a3e42804c562475d50fc4da11f6b038e152cc Mon Sep 17 00:00:00 2001 From: Bjarne Fyrstenborg Date: Tue, 19 Jan 2021 18:17:48 +0100 Subject: [PATCH 4/5] Inject missing localization service (cherry picked from commit c501ef0b68f135811ca9000e4f091c53851b5db4) --- .../directives/components/forms/umbradiobutton.directive.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/forms/umbradiobutton.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/forms/umbradiobutton.directive.js index 7ed84547f1..f8a3fd2d2e 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/forms/umbradiobutton.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/forms/umbradiobutton.directive.js @@ -36,7 +36,7 @@ (function () { 'use strict'; - function UmbRadiobuttonController($timeout) { + function UmbRadiobuttonController($timeout, localizationService) { var vm = this; From 0b3256c4feb8124b00cd461eabaca323415b851d Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Wed, 20 Jan 2021 11:24:28 +0100 Subject: [PATCH 5/5] Bump version to 8.7.2 --- src/SolutionInfo.cs | 6 +++--- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/SolutionInfo.cs b/src/SolutionInfo.cs index 087e5a3a55..597b416ffb 100644 --- a/src/SolutionInfo.cs +++ b/src/SolutionInfo.cs @@ -2,7 +2,7 @@ using System.Resources; [assembly: AssemblyCompany("Umbraco")] -[assembly: AssemblyCopyright("Copyright © Umbraco 2020")] +[assembly: AssemblyCopyright("Copyright © Umbraco 2021")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -18,5 +18,5 @@ using System.Resources; [assembly: AssemblyVersion("8.0.0")] // these are FYI and changed automatically -[assembly: AssemblyFileVersion("8.7.1")] -[assembly: AssemblyInformationalVersion("8.7.1")] +[assembly: AssemblyFileVersion("8.7.2")] +[assembly: AssemblyInformationalVersion("8.7.2")] diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index eb3159fa43..63b392b5e5 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -346,9 +346,9 @@ False True - 8710 + 8720 / - http://localhost:8710 + http://localhost:8720 8660 / http://localhost:8660