From 14af1aea9b92cbcba0e893e05681dfb4937b51d0 Mon Sep 17 00:00:00 2001 From: Bjarne Fyrstenborg Date: Tue, 24 Jan 2023 09:18:54 +0100 Subject: [PATCH 01/35] Ensure to reset padding and border as well for textarea in richtext (#13012) --- .../src/views/propertyeditors/rte/rte.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.html index 21e9065d92..d81b858002 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.html +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.html @@ -3,7 +3,7 @@
- +
From 33adbf41fa1f5c5d0759c70a7116114107addf56 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Thu, 26 Jan 2023 15:38:54 +0100 Subject: [PATCH 02/35] Update contributing docs with the correct branch name --- .github/CONTRIBUTING.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 3ff37ac79c..ff195a37ee 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -103,7 +103,7 @@ Great question! The short version goes like this: 1. **Switch to the correct branch** - Switch to the `v11/contrib` branch + Switch to the `contrib` branch 1. **Build** @@ -111,7 +111,7 @@ Great question! The short version goes like this: 1. **Branch** - Create a new branch now and name it after the issue you're fixing, we usually follow the format: `temp-12345`. This means it's a temporary branch for the particular issue you're working on, in this case issue number `12345`. Don't commit to `v11/contrib`, create a new branch first. + Create a new branch now and name it after the issue you're fixing, we usually follow the format: `temp-12345`. This means it's a temporary branch for the particular issue you're working on, in this case issue number `12345`. Don't commit to `contrib`, create a new branch first. 1. **Change** @@ -121,7 +121,7 @@ Great question! The short version goes like this: Done? Yay! 🎉 - Remember to commit to your new `temp` branch, and don't commit to `v11/contrib`. Then you can push the changes up to your fork on GitHub. + Remember to commit to your new `temp` branch, and don't commit to `contrib`. Then you can push the changes up to your fork on GitHub. #### Keeping your Umbraco fork in sync with the main repository [sync fork]: #keeping-your-umbraco-fork-in-sync-with-the-main-repository @@ -138,10 +138,10 @@ Then when you want to get the changes from the main repository: ``` git fetch upstream -git rebase upstream/v11/contrib +git rebase upstream/contrib ``` -In this command we're syncing with the `v11/contrib` branch, but you can of course choose another one if needed. +In this command we're syncing with the `contrib` branch, but you can of course choose another one if needed. [More information on how this works can be found on the thoughtbot blog.][sync fork ext] @@ -169,7 +169,7 @@ We recommend you to [sync with our repository][sync fork] before you submit your GitHub will have picked up on the new branch you've pushed and will offer to create a Pull Request. Click that green button and away you go. ![Create a pull request](img/createpullrequest.png) -We like to use [git flow][git flow] as much as possible, but don't worry if you are not familiar with it. The most important thing you need to know is that when you fork the Umbraco repository, the default branch is set to something, usually `v11/contrib`. If you are working on v9, this is the branch you should be targeting. +We like to use [git flow][git flow] as much as possible, but don't worry if you are not familiar with it. The most important thing you need to know is that when you fork the Umbraco repository, the default branch is set to `contrib`. This is the branch you should be targeting. Please note: we are no longer accepting features for v8 and below but will continue to merge security fixes as and when they arise. From d3b4bae1b5b248391f47266433a55225f5aad747 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 26 Jan 2023 14:33:08 +0000 Subject: [PATCH 03/35] Bump ua-parser-js from 0.7.31 to 0.7.33 in /src/Umbraco.Web.UI.Client Bumps [ua-parser-js](https://github.com/faisalman/ua-parser-js) from 0.7.31 to 0.7.33. - [Release notes](https://github.com/faisalman/ua-parser-js/releases) - [Changelog](https://github.com/faisalman/ua-parser-js/blob/master/changelog.md) - [Commits](https://github.com/faisalman/ua-parser-js/compare/0.7.31...0.7.33) --- updated-dependencies: - dependency-name: ua-parser-js dependency-type: indirect ... Signed-off-by: dependabot[bot] --- src/Umbraco.Web.UI.Client/package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/package-lock.json b/src/Umbraco.Web.UI.Client/package-lock.json index 21780e8bb2..47df840920 100644 --- a/src/Umbraco.Web.UI.Client/package-lock.json +++ b/src/Umbraco.Web.UI.Client/package-lock.json @@ -16459,9 +16459,9 @@ "dev": true }, "node_modules/ua-parser-js": { - "version": "0.7.31", - "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.31.tgz", - "integrity": "sha512-qLK/Xe9E2uzmYI3qLeOmI0tEOt+TBBQyUIAh4aAgU05FVYzeZrKUdkAZfBNVGRaHVgV0TDkdEngJSw/SyQchkQ==", + "version": "0.7.33", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.33.tgz", + "integrity": "sha512-s8ax/CeZdK9R/56Sui0WM6y9OFREJarMRHqLB2EwkovemBxNQ+Bqu8GAsUnVcXKgphb++ghr/B2BZx4mahujPw==", "dev": true, "funding": [ { @@ -30236,9 +30236,9 @@ "dev": true }, "ua-parser-js": { - "version": "0.7.31", - "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.31.tgz", - "integrity": "sha512-qLK/Xe9E2uzmYI3qLeOmI0tEOt+TBBQyUIAh4aAgU05FVYzeZrKUdkAZfBNVGRaHVgV0TDkdEngJSw/SyQchkQ==", + "version": "0.7.33", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.33.tgz", + "integrity": "sha512-s8ax/CeZdK9R/56Sui0WM6y9OFREJarMRHqLB2EwkovemBxNQ+Bqu8GAsUnVcXKgphb++ghr/B2BZx4mahujPw==", "dev": true }, "unbox-primitive": { From 03365f55c4548ed394b43a7f43de9e99cef3c5d0 Mon Sep 17 00:00:00 2001 From: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com> Date: Fri, 27 Jan 2023 09:52:37 +0100 Subject: [PATCH 04/35] Update label when updating color (#13720) Co-authored-by: Zeegaan --- .../multicolorpicker.controller.js | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/colorpicker/multicolorpicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/colorpicker/multicolorpicker.controller.js index 87dd85df04..0d0f58def3 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/colorpicker/multicolorpicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/colorpicker/multicolorpicker.controller.js @@ -18,7 +18,7 @@ angular.module("umbraco").controller("Umbraco.PrevalueEditors.MultiColorPickerCo // NOTE: We need to make each color an object, not just a string because you cannot 2-way bind to a primitive. const defaultColor = "000000"; const defaultLabel = null; - + $scope.newColor = defaultColor; $scope.newLabel = defaultLabel; $scope.hasError = false; @@ -48,20 +48,20 @@ angular.module("umbraco").controller("Umbraco.PrevalueEditors.MultiColorPickerCo } }); } - + var evts = []; evts.push(eventsService.on("toggleValue", function (e, args) { if (args.inputId === "useLabel") { vm.labelEnabled = args.value; } })); - + $scope.$on('$destroy', function () { for (var e in evts) { eventsService.unsubscribe(evts[e]); } }); - + if (!Utilities.isArray($scope.model.value)) { //make an array from the dictionary var items = []; @@ -127,11 +127,20 @@ angular.module("umbraco").controller("Umbraco.PrevalueEditors.MultiColorPickerCo label: newLabel }); } else { + + if(vm.editItem.value === vm.editItem.label && vm.editItem.value === newLabel) { + vm.editItem.label = $scope.newColor; + + } + else { + vm.editItem.label = newLabel; + } + vm.editItem.value = $scope.newColor; - vm.editItem.label = newLabel; + vm.editItem = null; } - + $scope.newLabel = ""; $scope.hasError = false; $scope.focusOnNew = true; From 23b03f408e6eb828de4df8328f744adb0e496b50 Mon Sep 17 00:00:00 2001 From: Marc Goodson Date: Thu, 19 Jan 2023 12:08:25 +0000 Subject: [PATCH 05/35] Add .woff2 to BrowsableFileExtensions --- src/Umbraco.Core/Configuration/Models/UmbracoPluginSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Core/Configuration/Models/UmbracoPluginSettings.cs b/src/Umbraco.Core/Configuration/Models/UmbracoPluginSettings.cs index bec6d77bfb..a59b9bf861 100644 --- a/src/Umbraco.Core/Configuration/Models/UmbracoPluginSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/UmbracoPluginSettings.cs @@ -19,7 +19,7 @@ public class UmbracoPluginSettings ".css", // styles ".js", // scripts ".jpg", ".jpeg", ".gif", ".png", ".svg", // images - ".eot", ".ttf", ".woff", // fonts + ".eot", ".ttf", ".woff", ".woff2", // fonts ".xml", ".json", ".config", // configurations ".lic", // license ".map", // js map files From d38fabea4a5bd43b980c21ef2b90cc6ba320da00 Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Mon, 30 Jan 2023 09:32:28 +0000 Subject: [PATCH 06/35] Fixes #13715 Simple LogViewer queries not returning results (#13748) * Fixes #13715 issue with simple logviewer searches * Update Logviewer test - to ensure MessageLike and simple equivalent returns same result count to help catch --- .../Logging/Viewer/ExpressionFilter.cs | 8 ++++---- .../Umbraco.Infrastructure/Logging/LogviewerTests.cs | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Infrastructure/Logging/Viewer/ExpressionFilter.cs b/src/Umbraco.Infrastructure/Logging/Viewer/ExpressionFilter.cs index a8444f4276..5e2130b5d3 100644 --- a/src/Umbraco.Infrastructure/Logging/Viewer/ExpressionFilter.cs +++ b/src/Umbraco.Infrastructure/Logging/Viewer/ExpressionFilter.cs @@ -29,7 +29,7 @@ internal class ExpressionFilter : ILogFilter // If the expression is one word and doesn't contain a serilog operator then we can perform a like search if (!filterExpression.Contains(" ") && !filterExpression.ContainsAny(ExpressionOperators.Select(c => c))) { - filter = PerformMessageLikeFilter(filterExpression); + filter = PerformMessageLikeFilter(filterExpression, customSerilogFunctions); } // check if it's a valid expression @@ -48,7 +48,7 @@ internal class ExpressionFilter : ILogFilter { // 'error' describes a syntax error, where it was unable to compile an expression // Assume the expression was a search string and make a Like filter from that - filter = PerformMessageLikeFilter(filterExpression); + filter = PerformMessageLikeFilter(filterExpression, customSerilogFunctions); } } @@ -57,10 +57,10 @@ internal class ExpressionFilter : ILogFilter public bool TakeLogEvent(LogEvent e) => _filter == null || _filter(e); - private Func? PerformMessageLikeFilter(string filterExpression) + private Func? PerformMessageLikeFilter(string filterExpression, SerilogLegacyNameResolver serilogLegacyNameResolver) { var filterSearch = $"@Message like '%{SerilogExpression.EscapeLikeExpressionContent(filterExpression)}%'"; - if (SerilogExpression.TryCompile(filterSearch, out CompiledExpression? compiled, out var error)) + if (SerilogExpression.TryCompile(filterSearch, null, serilogLegacyNameResolver, out CompiledExpression? compiled, out var error)) { // `compiled` is a function that can be executed against `LogEvent`s: return evt => diff --git a/tests/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Logging/LogviewerTests.cs b/tests/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Logging/LogviewerTests.cs index 45c8929628..5c028714b8 100644 --- a/tests/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Logging/LogviewerTests.cs +++ b/tests/Umbraco.Tests.UnitTests/Umbraco.Infrastructure/Logging/LogviewerTests.cs @@ -197,6 +197,8 @@ public class LogviewerTests [TestCase("@mt = '{EndMessage} ({Duration}ms) [Timing {TimingId}]'", 26)] [TestCase("SortedComponentTypes[?] = 'Umbraco.Web.Search.ExamineComponent'", 1)] [TestCase("Contains(SortedComponentTypes[?], 'DatabaseServer')", 1)] + [TestCase("@Message like '%definition%'", 6)] + [TestCase("definition", 6)] [Test] public void Logs_Can_Query_With_Expressions(string queryToVerify, int expectedCount) { From 417f31fba592116674080e5270ce336e39fec70c Mon Sep 17 00:00:00 2001 From: Fjellvang Date: Tue, 31 Jan 2023 09:04:26 +0100 Subject: [PATCH 07/35] Send email notification on password reset (#13757) Co-authored-by: Aleksander --- .../Controllers/AuthenticationController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.BackOffice/Controllers/AuthenticationController.cs b/src/Umbraco.Web.BackOffice/Controllers/AuthenticationController.cs index 7704344d4e..97aa5bd118 100644 --- a/src/Umbraco.Web.BackOffice/Controllers/AuthenticationController.cs +++ b/src/Umbraco.Web.BackOffice/Controllers/AuthenticationController.cs @@ -423,7 +423,7 @@ public class AuthenticationController : UmbracoApiControllerBase var mailMessage = new EmailMessage(from, user.Email, subject, message, true); - await _emailSender.SendAsync(mailMessage, Constants.Web.EmailTypes.PasswordReset); + await _emailSender.SendAsync(mailMessage, Constants.Web.EmailTypes.PasswordReset, true); _userManager.NotifyForgotPasswordRequested(User, user.Id.ToString()); } From 823c59cee1ab3fa80b27eb2f8c18d2a49f862807 Mon Sep 17 00:00:00 2001 From: Fjellvang Date: Tue, 31 Jan 2023 09:05:15 +0100 Subject: [PATCH 08/35] Send email notification on password reset (#13756) Co-authored-by: Aleksander --- .../Controllers/AuthenticationController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.BackOffice/Controllers/AuthenticationController.cs b/src/Umbraco.Web.BackOffice/Controllers/AuthenticationController.cs index 390482276e..7d49adaf39 100644 --- a/src/Umbraco.Web.BackOffice/Controllers/AuthenticationController.cs +++ b/src/Umbraco.Web.BackOffice/Controllers/AuthenticationController.cs @@ -421,7 +421,7 @@ public class AuthenticationController : UmbracoApiControllerBase var mailMessage = new EmailMessage(from, user.Email, subject, message, true); - await _emailSender.SendAsync(mailMessage, Constants.Web.EmailTypes.PasswordReset); + await _emailSender.SendAsync(mailMessage, Constants.Web.EmailTypes.PasswordReset, true); _userManager.NotifyForgotPasswordRequested(User, user.Id.ToString()); } From e87196909ac67304a122d58df07a39ec445b1c56 Mon Sep 17 00:00:00 2001 From: Andy Butland Date: Tue, 31 Jan 2023 09:46:45 +0100 Subject: [PATCH 09/35] Uses URL path separator when generating UDIs for files nested in folders. (#13689) --- .../Extensions/UdiGetterExtensions.cs | 17 +++--- .../Builders/PartialViewBuilder.cs | 41 +++++++++++++++ .../Builders/ScriptBuilder.cs | 33 ++++++++++++ .../Builders/StylesheetBuilder.cs | 2 +- .../Extensions/UdiGetterExtensionsTests.cs | 52 +++++++++++++++++++ 5 files changed, 138 insertions(+), 7 deletions(-) create mode 100644 tests/Umbraco.Tests.Common/Builders/PartialViewBuilder.cs create mode 100644 tests/Umbraco.Tests.Common/Builders/ScriptBuilder.cs create mode 100644 tests/Umbraco.Tests.UnitTests/Umbraco.Core/Extensions/UdiGetterExtensionsTests.cs diff --git a/src/Umbraco.Core/Extensions/UdiGetterExtensions.cs b/src/Umbraco.Core/Extensions/UdiGetterExtensions.cs index 1ad94cbdc3..03ed07f2fe 100644 --- a/src/Umbraco.Core/Extensions/UdiGetterExtensions.cs +++ b/src/Umbraco.Core/Extensions/UdiGetterExtensions.cs @@ -232,9 +232,7 @@ public static class UdiGetterExtensions throw new ArgumentNullException("entity"); } - return new StringUdi( - Constants.UdiEntityType.Stylesheet, - entity.Path.TrimStart(Constants.CharArrays.ForwardSlash)).EnsureClosed(); + return GetUdiFromPath(Constants.UdiEntityType.Stylesheet, entity.Path); } /// @@ -249,8 +247,15 @@ public static class UdiGetterExtensions throw new ArgumentNullException("entity"); } - return new StringUdi(Constants.UdiEntityType.Script, entity.Path.TrimStart(Constants.CharArrays.ForwardSlash)) - .EnsureClosed(); + return GetUdiFromPath(Constants.UdiEntityType.Script, entity.Path); + } + + private static StringUdi GetUdiFromPath(string entityType, string path) + { + var id = path + .TrimStart(Constants.CharArrays.ForwardSlash) + .Replace("\\", "/"); + return new StringUdi(entityType, id).EnsureClosed(); } /// @@ -300,7 +305,7 @@ public static class UdiGetterExtensions ? Constants.UdiEntityType.PartialViewMacro : Constants.UdiEntityType.PartialView; - return new StringUdi(entityType, entity.Path.TrimStart(Constants.CharArrays.ForwardSlash)).EnsureClosed(); + return GetUdiFromPath(entityType, entity.Path); } /// diff --git a/tests/Umbraco.Tests.Common/Builders/PartialViewBuilder.cs b/tests/Umbraco.Tests.Common/Builders/PartialViewBuilder.cs new file mode 100644 index 0000000000..ead5a4f189 --- /dev/null +++ b/tests/Umbraco.Tests.Common/Builders/PartialViewBuilder.cs @@ -0,0 +1,41 @@ +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using Umbraco.Cms.Core.Models; + +namespace Umbraco.Cms.Tests.Common.Builders; + +public class PartialViewBuilder + : BuilderBase +{ + private string _path; + private string _content; + private PartialViewType _viewType = PartialViewType.Unknown; + + public PartialViewBuilder WithPath(string path) + { + _path = path; + return this; + } + + public PartialViewBuilder WithContent(string content) + { + _content = content; + return this; + } + + public PartialViewBuilder WithViewType(PartialViewType viewType) + { + _viewType = viewType; + return this; + } + + public override IPartialView Build() + { + var path = _path ?? string.Empty; + var content = _content ?? string.Empty; + var viewType = _viewType; + + return new PartialView(viewType, path) { Content = content }; + } +} diff --git a/tests/Umbraco.Tests.Common/Builders/ScriptBuilder.cs b/tests/Umbraco.Tests.Common/Builders/ScriptBuilder.cs new file mode 100644 index 0000000000..9e521d0c0f --- /dev/null +++ b/tests/Umbraco.Tests.Common/Builders/ScriptBuilder.cs @@ -0,0 +1,33 @@ +// Copyright (c) Umbraco. +// See LICENSE for more details. + +using Umbraco.Cms.Core.Models; + +namespace Umbraco.Cms.Tests.Common.Builders; + +public class ScriptBuilder + : BuilderBase