From a98b52a46b4536bf4403c0ff2dc69b55caced95a Mon Sep 17 00:00:00 2001 From: Paul Woodland <7717900+paulwoodland@users.noreply.github.com> Date: Wed, 9 Mar 2022 08:51:49 +0000 Subject: [PATCH 01/41] Possible NullReferenceException in MultiUrlPickerValueConverter (#12109) * Fixed a bug in the MultiUrlPickerValueConverter file, where an invalid value being set will result in a NullReferenceException * Change to checking for whitespace values before de-serializing Co-authored-by: Paul Woodland --- .../ValueConverters/MultiUrlPickerValueConverter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/MultiUrlPickerValueConverter.cs b/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/MultiUrlPickerValueConverter.cs index 3d8f15f6d0..281f6c58eb 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/MultiUrlPickerValueConverter.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/MultiUrlPickerValueConverter.cs @@ -51,7 +51,7 @@ namespace Umbraco.Cms.Core.PropertyEditors.ValueConverters { var maxNumber = propertyType.DataType.ConfigurationAs().MaxNumber; - if (inter == null) + if (string.IsNullOrWhiteSpace(inter?.ToString())) { return maxNumber == 1 ? null : Enumerable.Empty(); } From 62b289e1790c721bb9bc3c717c21a4d13de7a173 Mon Sep 17 00:00:00 2001 From: Andrey Karandashov <51944778+AndreyKarandashovUKAD@users.noreply.github.com> Date: Wed, 9 Mar 2022 17:47:54 +0200 Subject: [PATCH 02/41] Block List Settings throws exception if Models builder mode is set to "Nothing" (#11725) --- .../BlockListPropertyValueConverter.cs | 15 ++++++++++++++- .../BlockListPropertyValueConverterTests.cs | 5 ++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/BlockListPropertyValueConverter.cs b/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/BlockListPropertyValueConverter.cs index 6916f2ea3f..1c8c7c7d4f 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/BlockListPropertyValueConverter.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/BlockListPropertyValueConverter.cs @@ -4,9 +4,14 @@ using System; using System.Collections.Generic; using System.Linq; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; +using Umbraco.Cms.Core.Configuration; +using Umbraco.Cms.Core.Configuration.Models; using Umbraco.Cms.Core.Logging; using Umbraco.Cms.Core.Models.Blocks; using Umbraco.Cms.Core.Models.PublishedContent; +using Umbraco.Cms.Web.Common.DependencyInjection; using Umbraco.Extensions; namespace Umbraco.Cms.Core.PropertyEditors.ValueConverters @@ -17,12 +22,20 @@ namespace Umbraco.Cms.Core.PropertyEditors.ValueConverters private readonly IProfilingLogger _proflog; private readonly BlockEditorConverter _blockConverter; private readonly BlockListEditorDataConverter _blockListEditorDataConverter; + private readonly ModelsBuilderSettings _modelsBuilderSettings; + [Obsolete("Use ctor injecting ModelsBuilderSettings")] public BlockListPropertyValueConverter(IProfilingLogger proflog, BlockEditorConverter blockConverter) + : this(proflog, blockConverter,StaticServiceProvider.Instance.GetRequiredService>()) + { + } + + public BlockListPropertyValueConverter(IProfilingLogger proflog, BlockEditorConverter blockConverter, IOptions modelsBuilderOptions) { _proflog = proflog; _blockConverter = blockConverter; _blockListEditorDataConverter = new BlockListEditorDataConverter(); + _modelsBuilderSettings = modelsBuilderOptions?.Value; } /// @@ -116,7 +129,7 @@ namespace Umbraco.Cms.Core.PropertyEditors.ValueConverters } // Get settings type from configuration - var settingsType = blockConfig.SettingsElementTypeKey.HasValue + var settingsType = blockConfig.SettingsElementTypeKey.HasValue && _modelsBuilderSettings.ModelsMode != ModelsMode.Nothing ? _blockConverter.GetModelType(blockConfig.SettingsElementTypeKey.Value) : typeof(IPublishedElement); diff --git a/tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/BlockListPropertyValueConverterTests.cs b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/BlockListPropertyValueConverterTests.cs index 084bf03370..09fc427d12 100644 --- a/tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/BlockListPropertyValueConverterTests.cs +++ b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/BlockListPropertyValueConverterTests.cs @@ -2,9 +2,11 @@ // See LICENSE for more details. using System; +using Microsoft.Extensions.Options; using Moq; using NUnit.Framework; using Umbraco.Cms.Core; +using Umbraco.Cms.Core.Configuration.Models; using Umbraco.Cms.Core.Logging; using Umbraco.Cms.Core.Models.Blocks; using Umbraco.Cms.Core.Models.PublishedContent; @@ -62,9 +64,10 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.PropertyEditors { IPublishedSnapshotAccessor publishedSnapshotAccessor = GetPublishedSnapshotAccessor(); var publishedModelFactory = new NoopPublishedModelFactory(); + var modelsBuilderSettings = Mock.Of>(x => x.Value == new ModelsBuilderSettings()); var editor = new BlockListPropertyValueConverter( Mock.Of(), - new BlockEditorConverter(publishedSnapshotAccessor, publishedModelFactory)); + new BlockEditorConverter(publishedSnapshotAccessor, publishedModelFactory), modelsBuilderSettings); return editor; } From 3c40c20d27789c6c61e0541ee6d7145233a99155 Mon Sep 17 00:00:00 2001 From: vsilvar Date: Tue, 15 Feb 2022 15:09:31 +0100 Subject: [PATCH 03/41] Made sure Umbraco files aren't included twice This fixes CS8785 RazorSourceGenerator failures due to repeated files in .Net 6 --- .../NuSpecs/buildTransitive/Umbraco.Cms.StaticAssets.targets | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build/NuSpecs/buildTransitive/Umbraco.Cms.StaticAssets.targets b/build/NuSpecs/buildTransitive/Umbraco.Cms.StaticAssets.targets index 7f73c14650..2a95da1cd9 100644 --- a/build/NuSpecs/buildTransitive/Umbraco.Cms.StaticAssets.targets +++ b/build/NuSpecs/buildTransitive/Umbraco.Cms.StaticAssets.targets @@ -39,6 +39,7 @@ @@ -65,6 +66,7 @@ @@ -92,7 +94,7 @@ - + From cade6cb68473c3e09b09a9d297be8efd9f986f92 Mon Sep 17 00:00:00 2001 From: Bjarne Fyrstenborg Date: Wed, 9 Mar 2022 17:18:28 +0100 Subject: [PATCH 04/41] Add missing copy member type menu action (#12089) --- .../Controllers/MemberTypeController.cs | 14 +++++++ .../Trees/MemberGroupTreeController.cs | 5 ++- .../MemberTypeAndGroupTreeControllerBase.cs | 39 ++++++++++++++++++- .../Trees/MemberTypeTreeController.cs | 3 +- 4 files changed, 55 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Web.BackOffice/Controllers/MemberTypeController.cs b/src/Umbraco.Web.BackOffice/Controllers/MemberTypeController.cs index 7c1f6f4187..724e17adb1 100644 --- a/src/Umbraco.Web.BackOffice/Controllers/MemberTypeController.cs +++ b/src/Umbraco.Web.BackOffice/Controllers/MemberTypeController.cs @@ -252,5 +252,19 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers return display; } + + /// + /// Copy the member type + /// + /// + /// + [Authorize(Policy = AuthorizationPolicies.TreeAccessMemberTypes)] + public IActionResult PostCopy(MoveOrCopy copy) + { + return PerformCopy( + copy, + i => _memberTypeService.Get(i), + (type, i) => _memberTypeService.Copy(type, i)); + } } } diff --git a/src/Umbraco.Web.BackOffice/Trees/MemberGroupTreeController.cs b/src/Umbraco.Web.BackOffice/Trees/MemberGroupTreeController.cs index 0559a17a53..858a1c8184 100644 --- a/src/Umbraco.Web.BackOffice/Trees/MemberGroupTreeController.cs +++ b/src/Umbraco.Web.BackOffice/Trees/MemberGroupTreeController.cs @@ -26,8 +26,9 @@ namespace Umbraco.Cms.Web.BackOffice.Trees UmbracoApiControllerTypeCollection umbracoApiControllerTypeCollection, IMenuItemCollectionFactory menuItemCollectionFactory, IMemberGroupService memberGroupService, - IEventAggregator eventAggregator) - : base(localizedTextService, umbracoApiControllerTypeCollection, menuItemCollectionFactory, eventAggregator) + IEventAggregator eventAggregator, + IMemberTypeService memberTypeService) + : base(localizedTextService, umbracoApiControllerTypeCollection, menuItemCollectionFactory, eventAggregator, memberTypeService) => _memberGroupService = memberGroupService; protected override IEnumerable GetTreeNodesFromService(string id, FormCollection queryStrings) diff --git a/src/Umbraco.Web.BackOffice/Trees/MemberTypeAndGroupTreeControllerBase.cs b/src/Umbraco.Web.BackOffice/Trees/MemberTypeAndGroupTreeControllerBase.cs index 94c84accab..64e8081dec 100644 --- a/src/Umbraco.Web.BackOffice/Trees/MemberTypeAndGroupTreeControllerBase.cs +++ b/src/Umbraco.Web.BackOffice/Trees/MemberTypeAndGroupTreeControllerBase.cs @@ -1,6 +1,8 @@ +using System; using System.Collections.Generic; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.DependencyInjection; using Umbraco.Cms.Core; using Umbraco.Cms.Core.Actions; using Umbraco.Cms.Core.Events; @@ -8,6 +10,8 @@ using Umbraco.Cms.Core.Models.Trees; using Umbraco.Cms.Core.Services; using Umbraco.Cms.Core.Trees; using Umbraco.Cms.Web.Common.Attributes; +using Umbraco.Cms.Web.Common.DependencyInjection; +using Umbraco.Extensions; using Constants = Umbraco.Cms.Core.Constants; namespace Umbraco.Cms.Web.BackOffice.Trees @@ -16,21 +20,46 @@ namespace Umbraco.Cms.Web.BackOffice.Trees [CoreTree] public abstract class MemberTypeAndGroupTreeControllerBase : TreeController { + private readonly IMemberTypeService _memberTypeService; + public IMenuItemCollectionFactory MenuItemCollectionFactory { get; } protected MemberTypeAndGroupTreeControllerBase( ILocalizedTextService localizedTextService, UmbracoApiControllerTypeCollection umbracoApiControllerTypeCollection, IMenuItemCollectionFactory menuItemCollectionFactory, - IEventAggregator eventAggregator) + IEventAggregator eventAggregator, + IMemberTypeService memberTypeService) : base(localizedTextService, umbracoApiControllerTypeCollection, eventAggregator) { MenuItemCollectionFactory = menuItemCollectionFactory; + + _memberTypeService = memberTypeService; + } + + [Obsolete("Use ctor injecting IMemberTypeService")] + protected MemberTypeAndGroupTreeControllerBase( + ILocalizedTextService localizedTextService, + UmbracoApiControllerTypeCollection umbracoApiControllerTypeCollection, + IMenuItemCollectionFactory menuItemCollectionFactory, + IEventAggregator eventAggregator) + : this( + localizedTextService, + umbracoApiControllerTypeCollection, + menuItemCollectionFactory, + eventAggregator, + StaticServiceProvider.Instance.GetRequiredService()) + { } protected override ActionResult GetTreeNodes(string id, FormCollection queryStrings) { var nodes = new TreeNodeCollection(); + + // if the request is for folders only then just return + if (queryStrings["foldersonly"].ToString().IsNullOrWhiteSpace() == false && queryStrings["foldersonly"].ToString() == "1") + return nodes; + nodes.AddRange(GetTreeNodesFromService(id, queryStrings)); return nodes; } @@ -48,7 +77,13 @@ namespace Umbraco.Cms.Web.BackOffice.Trees } else { - //delete member type/group + var memberType = _memberTypeService.Get(int.Parse(id)); + if (memberType != null) + { + menu.Items.Add(LocalizedTextService, opensDialog: true); + } + + // delete member type/group menu.Items.Add(LocalizedTextService, opensDialog: true); } diff --git a/src/Umbraco.Web.BackOffice/Trees/MemberTypeTreeController.cs b/src/Umbraco.Web.BackOffice/Trees/MemberTypeTreeController.cs index 5595365e2b..318cce629d 100644 --- a/src/Umbraco.Web.BackOffice/Trees/MemberTypeTreeController.cs +++ b/src/Umbraco.Web.BackOffice/Trees/MemberTypeTreeController.cs @@ -32,13 +32,12 @@ namespace Umbraco.Cms.Web.BackOffice.Trees UmbracoTreeSearcher treeSearcher, IMemberTypeService memberTypeService, IEventAggregator eventAggregator) - : base(localizedTextService, umbracoApiControllerTypeCollection, menuItemCollectionFactory, eventAggregator) + : base(localizedTextService, umbracoApiControllerTypeCollection, menuItemCollectionFactory, eventAggregator, memberTypeService) { _treeSearcher = treeSearcher; _memberTypeService = memberTypeService; } - protected override ActionResult CreateRootNode(FormCollection queryStrings) { var rootResult = base.CreateRootNode(queryStrings); From 8c9410a30766890fed356d166d8d8c29f15db594 Mon Sep 17 00:00:00 2001 From: CyberReiter <90895378+CyberReiter@users.noreply.github.com> Date: Sun, 13 Mar 2022 23:46:35 +0100 Subject: [PATCH 05/41] v9/bugfix/remove_useless_tolists: removed useless tolist()'s (#12123) Co-authored-by: Reiter --- src/Umbraco.Core/Composing/TypeFinder.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Core/Composing/TypeFinder.cs b/src/Umbraco.Core/Composing/TypeFinder.cs index 07a2eb72c9..0ce78b5b84 100644 --- a/src/Umbraco.Core/Composing/TypeFinder.cs +++ b/src/Umbraco.Core/Composing/TypeFinder.cs @@ -198,7 +198,7 @@ namespace Umbraco.Cms.Core.Composing IEnumerable assemblies = null, bool onlyConcreteClasses = true) { - var assemblyList = (assemblies ?? AssembliesToScan).ToList(); + var assemblyList = assemblies ?? AssembliesToScan; return GetClassesWithBaseType(assignTypeFrom, assemblyList, onlyConcreteClasses, //the additional filter will ensure that any found types also have the attribute applied. @@ -214,7 +214,7 @@ namespace Umbraco.Cms.Core.Composing /// public IEnumerable FindClassesOfType(Type assignTypeFrom, IEnumerable assemblies = null, bool onlyConcreteClasses = true) { - var assemblyList = (assemblies ?? AssembliesToScan).ToList(); + var assemblyList = assemblies ?? AssembliesToScan; return GetClassesWithBaseType(assignTypeFrom, assemblyList, onlyConcreteClasses); } @@ -231,7 +231,7 @@ namespace Umbraco.Cms.Core.Composing IEnumerable assemblies = null, bool onlyConcreteClasses = true) { - var assemblyList = (assemblies ?? AssembliesToScan).ToList(); + var assemblyList = assemblies ?? AssembliesToScan; return GetClassesWithAttribute(attributeType, assemblyList, onlyConcreteClasses); } From 886d7f1a255acda0a9d001a4177f9e7481c979c6 Mon Sep 17 00:00:00 2001 From: patrickdemooij9 Date: Wed, 9 Mar 2022 14:50:49 +0100 Subject: [PATCH 06/41] Add allowedChildren call to Outgoing Editor events --- .../SendingAllowedChildrenNotification.cs | 19 +++++++++++++++++++ .../Controllers/ContentTypeController.cs | 2 ++ .../Controllers/MediaTypeController.cs | 2 ++ .../OutgoingEditorModelEventAttribute.cs | 6 ++++++ 4 files changed, 29 insertions(+) create mode 100644 src/Umbraco.Core/Notifications/SendingAllowedChildrenNotification.cs diff --git a/src/Umbraco.Core/Notifications/SendingAllowedChildrenNotification.cs b/src/Umbraco.Core/Notifications/SendingAllowedChildrenNotification.cs new file mode 100644 index 0000000000..07ab3c3626 --- /dev/null +++ b/src/Umbraco.Core/Notifications/SendingAllowedChildrenNotification.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; +using Umbraco.Cms.Core.Models.ContentEditing; +using Umbraco.Cms.Core.Web; + +namespace Umbraco.Cms.Core.Notifications +{ + public class SendingAllowedChildrenNotification : INotification + { + public IUmbracoContext UmbracoContext { get; } + + public IEnumerable Children { get; set; } + + public SendingAllowedChildrenNotification(IEnumerable children, IUmbracoContext umbracoContext) + { + UmbracoContext = umbracoContext; + Children = children; + } + } +} diff --git a/src/Umbraco.Web.BackOffice/Controllers/ContentTypeController.cs b/src/Umbraco.Web.BackOffice/Controllers/ContentTypeController.cs index 99d22de939..8c9beb931c 100644 --- a/src/Umbraco.Web.BackOffice/Controllers/ContentTypeController.cs +++ b/src/Umbraco.Web.BackOffice/Controllers/ContentTypeController.cs @@ -22,6 +22,7 @@ using Umbraco.Cms.Core.Security; using Umbraco.Cms.Core.Services; using Umbraco.Cms.Core.Strings; using Umbraco.Cms.Infrastructure.Packaging; +using Umbraco.Cms.Web.BackOffice.Filters; using Umbraco.Cms.Web.Common.ActionsResults; using Umbraco.Cms.Web.Common.Attributes; using Umbraco.Cms.Web.Common.Authorization; @@ -452,6 +453,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers /// /// [Authorize(Policy = AuthorizationPolicies.TreeAccessDocumentsOrDocumentTypes)] + [OutgoingEditorModelEvent] public IEnumerable GetAllowedChildren(int contentId) { if (contentId == Constants.System.RecycleBinContent) diff --git a/src/Umbraco.Web.BackOffice/Controllers/MediaTypeController.cs b/src/Umbraco.Web.BackOffice/Controllers/MediaTypeController.cs index cd1e9037ec..66efc37f47 100644 --- a/src/Umbraco.Web.BackOffice/Controllers/MediaTypeController.cs +++ b/src/Umbraco.Web.BackOffice/Controllers/MediaTypeController.cs @@ -12,6 +12,7 @@ using Umbraco.Cms.Core.Models.ContentEditing; using Umbraco.Cms.Core.Security; using Umbraco.Cms.Core.Services; using Umbraco.Cms.Core.Strings; +using Umbraco.Cms.Web.BackOffice.Filters; using Umbraco.Cms.Web.Common.ActionsResults; using Umbraco.Cms.Web.Common.Attributes; using Umbraco.Cms.Web.Common.Authorization; @@ -339,6 +340,7 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers /// /// [Authorize(Policy = AuthorizationPolicies.TreeAccessMediaOrMediaTypes)] + [OutgoingEditorModelEvent] public IEnumerable GetAllowedChildren(int contentId) { if (contentId == Constants.System.RecycleBinContent) diff --git a/src/Umbraco.Web.BackOffice/Filters/OutgoingEditorModelEventAttribute.cs b/src/Umbraco.Web.BackOffice/Filters/OutgoingEditorModelEventAttribute.cs index 8899499887..ed086f7ed5 100644 --- a/src/Umbraco.Web.BackOffice/Filters/OutgoingEditorModelEventAttribute.cs +++ b/src/Umbraco.Web.BackOffice/Filters/OutgoingEditorModelEventAttribute.cs @@ -84,6 +84,12 @@ namespace Umbraco.Cms.Web.BackOffice.Filters case IEnumerable> dashboards: _eventAggregator.Publish(new SendingDashboardsNotification(dashboards, umbracoContext)); break; + case IEnumerable allowedChildren: + // Changing the Enumerable will generate a new instance, so we need to update the context result with the new content + var notification = new SendingAllowedChildrenNotification(allowedChildren, umbracoContext); + _eventAggregator.Publish(notification); + context.Result = new ObjectResult(notification.Children); + break; } } } From ead813989dd6ded1d941b82b85125361ae8fb407 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Fri, 18 Mar 2022 13:36:40 +0100 Subject: [PATCH 07/41] Code of conduct has been moved to an organization-wide repository --- .github/CODE_OF_CONDUCT.md | 93 -------------------------- .github/CODE_OF_CONDUCT_ENFORCEMENT.md | 57 ---------------- 2 files changed, 150 deletions(-) delete mode 100644 .github/CODE_OF_CONDUCT.md delete mode 100644 .github/CODE_OF_CONDUCT_ENFORCEMENT.md diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md deleted file mode 100644 index 1acc6b602b..0000000000 --- a/.github/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,93 +0,0 @@ -# Umbraco Code of Conduct - -## Preamble - -We are the friendly CMS. And our friendliness stems from our values. That's why we have set for ourselves, Umbraco HQ, and the community, five values to guide us in everything we do: - -* Trust - We believe in and empower people -* Respect - We treat others as we would like to be treated -* Open - We share our thoughts and knowledge -* Hungry - We want to do things better, best is next -* Friendly - We want to build long-lasting relationships - -With these values in mind, we want to offer the Umbraco community a code of conduct that specifies a baseline standard of behavior so that people with different social values and communication styles can work together. - -This code of conduct is based on the widely used Contributor Covenant, as described in [https://www.contributor-covenant.org/](https://www.contributor-covenant.org/) - -## Our Pledge - -We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. - -We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. - -## Our Standards -Examples of behavior that contributes to a positive environment for our community include: - -* Demonstrating empathy and kindness toward other people -* Being respectful of differing opinions, viewpoints, and experiences -* Giving and gracefully accepting constructive feedback -* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience -* Focusing on what is best not just for us as individuals, but for the overall community - -Examples of unacceptable behavior include: - -* The use of sexualized language or imagery, and sexual attention or advances of any kind -* Trolling, insulting or derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or email address, without their explicit permission -* Other conduct which could reasonably be considered inappropriate in a professional setting - -## Enforcement Responsibilities - -Community leaders (e.g. Meetup & festival organizers, moderators, maintainers, ...) are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. - -Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. - -Specific enforcement steps are listed in the [Code of Conduct Enforcement Guidelines](https://github.com/umbraco/Umbraco-CMS/blob/v8/contrib/.github/CODE_OF_CONDUCT_ENFORCEMENT.md) document which is an appendix of this document, updated and maintained by the Code of Conduct Team. - -## Scope -This Code of Conduct applies within all community spaces and events supported by Umbraco HQ or using the Umbraco name. It also applies when an individual is officially representing the community in public spaces. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior, may be reported at [conduct@umbraco.com](mailto:conduct@umbraco.com). All complaints will be reviewed and investigated promptly and fairly. - -Or alternatively, you can reach out directly to any of the team members behind the address above: - -* Sebastiaan Janssen (He, Him - Languages spoken: English, Dutch, Danish(Read)) [sebastiaan@umbraco.com](mailto:sebastiaan@umbraco.com) -* Ilham Boulghallat (She, Her - Languages spoken: English, French, Arabic) [ilham@umbraco.com](mailto:ilham@umbraco.com) -* Arnold Visser (He, Him - Languages spoken: English, Dutch) [arnold@umbraco.com](mailto:arnold@umbraco.com) -* Emma Burstow (She, Her - Languages spoken: English) [ema@umbraco.com](mailto:ema@umbraco.com) - -The review process is done with full respect for the privacy and security of the reporter of any incident. - -People with a conflict of interest should exclude themselves or if necessary be excluded by the other team members. - -## Enforcement Guidelines - -Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: - -**1. Correction** -Community Impact: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. - -Consequence: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. - -**2. Warning** -Community Impact: A violation through a single incident or series of actions. - -Consequence: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. - -**3. Temporary Ban** -Community Impact: A serious violation of community standards, including sustained inappropriate behavior. - -Consequence: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. - -**4. Permanent Ban** -Community Impact: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. - -Consequence: A permanent ban from any sort of public interaction within the community. - -## Attribution -This Code of Conduct is adapted from the Contributor Covenant, version 2.0, available at [https://www.contributor-covenant.org/version/2/0/code_of_conduct.html](https://www.contributor-covenant.org/version/2/0/code_of_conduct.html). - -This Code of Conduct will be maintained and reviewed by the team listed above. diff --git a/.github/CODE_OF_CONDUCT_ENFORCEMENT.md b/.github/CODE_OF_CONDUCT_ENFORCEMENT.md deleted file mode 100644 index 2bb45644c2..0000000000 --- a/.github/CODE_OF_CONDUCT_ENFORCEMENT.md +++ /dev/null @@ -1,57 +0,0 @@ -# Umbraco Code of Conduct Enforcement guidelines - Consequence Ladder - -These are the steps followed by the [Umbraco Code of Conduct Team](https://github.com/umbraco/Umbraco-CMS/blob/v8/contrib/.github/CODE_OF_CONDUCT.md) when we respond to an issue or incident brought to our attention by a community member. - -This is an appendix to the Code of Conduct and is updated and maintained by the Code of Conduct Team. - -To make sure that all reports will be reviewed and investigated promptly and fairly, as highlighted in the Umbraco Code of Conduct, we are following [Mozilla’s Consequence Ladder approach](https://github.com/mozilla/inclusion/blob/master/code-of-conduct-enforcement/consequence-ladder.md). - -This approach helps the Team enforce the Code of Conduct in a structured manner and can be used as a way of communicating escalation. Each time the Team takes an action (warning, ban) the individual is made aware of future consequences. The Team can either follow the order of the levels in the ladder or decide to jump levels. When needed, the team can go directly to a permanent ban. - -**Level 0: No Action** -Recommendations do not indicate a violation of the Code of Conduct. - -**Level 1: Simple Warning Issued** -A private, written warning from the Code of Conduct Team, with clarity of violation, consequences of continued behavior. - -**Level 2: Warning** -A private, written warning from the Code of Conduct Team, with clarity of violation, consequences of continued behavior. Additionally: - -* Communication of next-level consequences if behaviors are repeated (according to this ladder). - -**Level 3: Warning + Mandatory Cooling Off Period (Access Retained)** -A private warning from the Code of Conduct Team, with clarity of violation, consequences of continued behavior. Additionally: - -* Request to avoid interaction on community messaging platforms (public forums, Our, commenting on issues). - * This includes avoiding any interactions in any Umbraco channels, spaces/offices, as well as external channels like social media (e.g. Twitter, Facebook, LinkedIn). For example, 'following/liking/retweeting' would be considered a violation of these terms, and consequence would escalate according to this ladder. -* Require they do not interact with others in the report, or those who they suspect are involved in the report. -* Suggestions for 'out of office' type of message on platforms, to reduce curiosity, or suspicion among those not involved. - -**Level 4: Temporary Ban (Access Revoked)** -Private communication of ban from the Code of Conduct Team, with clarity of violation, consequences of continued behavior. Additionally: - -* 3-6 months imposed break. -* All accounts deactivated, or blocked during this time (Our, HQ Slack if applicable). -* Require to avoid interaction on community messaging platforms (public forums, Our, commenting on issues). - * This includes avoiding any interactions in any Umbraco channels, spaces/offices, as well as external channels like social media (e.g. Twitter, Facebook, LinkedIn). For example, 'following/liking/retweeting' would be considered a violation of these terms, and consequence would escalate according to this ladder. -* All community leadership roles (e.g. Community Teams, Meetup/festival organizer, Commit right on Github..) suspended. (onboarding/reapplication required outside of this process) -* No attendance at Umbraco events during the ban period. -* Not allowed to enter Umbraco HQ offices during the ban period. -* Permission to use the MVP title, if applicable, is revoked during this ban period. -* The community leaders running events and other initiatives are informed of the ban. - -**Level 5: Permanent Ban** -Private communication of ban from the Code of Conduct Team, with clarity of violation, consequences of continued behavior. Additionally: - -* All accounts deactivated permanently. -* No attendance at Umbraco events going forward. -* Not allowed to enter Umbraco HQ offices permanently. -* All community leadership roles (e.g. Community Teams, Meetup/festival organizer, Commit right on Github..) permanently suspended. -* Permission to use the MVP title, if applicable, revoked. -* The community leaders running events and other initiatives are informed of the ban. - - -Sources: -* [Mozilla Code of Conduct - Enforcement Consequence Ladder](https://github.com/mozilla/inclusion/blob/master/code-of-conduct-enforcement/consequence-ladder.md) -* [Drupal Conflict Resolution Policy and Process](https://www.drupal.org/conflict-resolution) -* [Django Code of Conduct - Enforcement Manual](https://www.djangoproject.com/conduct/enforcement-manual/) From 4469191c998512c6534861b13048264753fe61f6 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Fri, 18 Mar 2022 13:40:03 +0100 Subject: [PATCH 08/41] Updating some more obsolete Code of Conduct usages --- .github/CONTRIBUTING.md | 2 +- .github/README.md | 2 +- umbraco-netcore-only.sln | 1 - umbraco.sln | 1 - 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 4cb593a39b..e8b378fb15 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -10,7 +10,7 @@ Remember, we're a friendly bunch and are happy with whatever contribution you mi **Code of conduct** -This project and everyone participating in it, is governed by the [our Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to [Sebastiaan Janssen - sj@umbraco.dk](mailto:sj@umbraco.dk). +This project and everyone participating in it, is governed by the [our Code of Conduct](https://github.com/umbraco/.github/blob/main/.github/CODE_OF_CONDUCT.md). **Table of contents** diff --git a/.github/README.md b/.github/README.md index d4565a8cb5..95ba778db2 100644 --- a/.github/README.md +++ b/.github/README.md @@ -15,7 +15,7 @@ See the official [Umbraco website](https://umbraco.com) for an introduction, cor - [Community](#join-the-umbraco-community) - [Contributing](#contributing) -Please also see our [Code of Conduct](CODE_OF_CONDUCT.md). +Please also see our [Code of Conduct](https://github.com/umbraco/.github/blob/main/.github/CODE_OF_CONDUCT.md). ## Getting Started diff --git a/umbraco-netcore-only.sln b/umbraco-netcore-only.sln index 80a688bde5..c34dd9e11d 100644 --- a/umbraco-netcore-only.sln +++ b/umbraco-netcore-only.sln @@ -16,7 +16,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{FD962632-1 ProjectSection(SolutionItems) = preProject .github\BUILD.md = .github\BUILD.md .github\CLEAR.md = .github\CLEAR.md - .github\CODE_OF_CONDUCT.md = .github\CODE_OF_CONDUCT.md .github\CONTRIBUTING.md = .github\CONTRIBUTING.md .github\CONTRIBUTING_DETAILED.md = .github\CONTRIBUTING_DETAILED.md .github\CONTRIBUTION_GUIDELINES.md = .github\CONTRIBUTION_GUIDELINES.md diff --git a/umbraco.sln b/umbraco.sln index 497258c699..7a6c7a04e8 100644 --- a/umbraco.sln +++ b/umbraco.sln @@ -15,7 +15,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{FD962632-1 ProjectSection(SolutionItems) = preProject .github\BUILD.md = .github\BUILD.md .github\CLEAR.md = .github\CLEAR.md - .github\CODE_OF_CONDUCT.md = .github\CODE_OF_CONDUCT.md .github\CONTRIBUTING.md = .github\CONTRIBUTING.md .github\CONTRIBUTING_DETAILED.md = .github\CONTRIBUTING_DETAILED.md .github\CONTRIBUTION_GUIDELINES.md = .github\CONTRIBUTION_GUIDELINES.md From defe9d432b64928a1b7a2287453ee14ca3173cfe Mon Sep 17 00:00:00 2001 From: Marc Goodson Date: Thu, 17 Mar 2022 23:59:32 +0000 Subject: [PATCH 09/41] Add a basic oEmbedProvider for LottieFiles animations --- .../UmbracoBuilder.Collections.cs | 3 +- .../Media/EmbedProviders/LottieFiles.cs | 52 +++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/Umbraco.Core/Media/EmbedProviders/LottieFiles.cs diff --git a/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Collections.cs b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Collections.cs index a0ff6104a7..578498de42 100644 --- a/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Collections.cs +++ b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.Collections.cs @@ -118,7 +118,8 @@ namespace Umbraco.Cms.Core.DependencyInjection .Append() .Append() .Append() - .Append(); + .Append() + .Append(); builder.SearchableTrees().Add(() => builder.TypeLoader.GetTypes()); builder.BackOfficeAssets(); } diff --git a/src/Umbraco.Core/Media/EmbedProviders/LottieFiles.cs b/src/Umbraco.Core/Media/EmbedProviders/LottieFiles.cs new file mode 100644 index 0000000000..938d22d37d --- /dev/null +++ b/src/Umbraco.Core/Media/EmbedProviders/LottieFiles.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Text.RegularExpressions; +using Umbraco.Cms.Core.Serialization; + +namespace Umbraco.Cms.Core.Media.EmbedProviders +{ + /// + /// Embed Provider for lottiefiles.com the popular opensource JSON-based animation format platform. + /// + public class LottieFiles : OEmbedProviderBase + { + public LottieFiles(IJsonSerializer jsonSerializer) : base(jsonSerializer) + { + + } + + public override string ApiEndpoint => "https://embed.lottiefiles.com/oembed"; + + public override string[] UrlSchemeRegex => new string[] + { + @"lottiefiles\.com/*" + }; + public override Dictionary RequestParams => new Dictionary(); + + public override string GetMarkup(string url, int maxWidth = 0, int maxHeight = 0) + { + var requestUrl = base.GetEmbedProviderUrl(url, maxWidth, maxHeight); + OEmbedResponse oembed = base.GetJsonResponse(requestUrl); + var html = oembed.GetHtml(); + //LottieFiles doesn't seem to support maxwidth and maxheight via oembed + // this is therefore a hack... with regexes.. is that ok? HtmlAgility etc etc + // otherwise it always defaults to 300... + if (maxWidth > 0 && maxHeight > 0) + { + + html = Regex.Replace(html, "width=\"([0-9]{1,4})\"", "width=\"" + maxWidth + "\""); + html = Regex.Replace(html, "height=\"([0-9]{1,4})\"", "height=\"" + maxHeight + "\""); + + } + else + { + //if set to 0, let's default to 100% as an easter egg + html = Regex.Replace(html, "width=\"([0-9]{1,4})\"", "width=\"100%\""); + html = Regex.Replace(html, "height=\"([0-9]{1,4})\"", "height=\"100%\""); + } + return html; + } + + } +} From 18c2a18ec802baa3db700ccc352446285df596ab Mon Sep 17 00:00:00 2001 From: Vitor Rodrigues Date: Sun, 20 Mar 2022 13:12:45 +0100 Subject: [PATCH 10/41] Fixes RecurringHostServices leaking the execution context / ambient scope (#12022) As timers flow the execution context by default this resulted in the Ambient context scope being shared --- .../HostedServices/RecurringHostedServiceBase.cs | 13 ++++++++++++- .../Services/Implement/CacheInstructionService.cs | 7 +++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs b/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs index d97737a8f8..1a69533f2d 100644 --- a/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs +++ b/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs @@ -40,7 +40,18 @@ namespace Umbraco.Cms.Infrastructure.HostedServices /// public Task StartAsync(CancellationToken cancellationToken) { - _timer = new Timer(ExecuteAsync, null, (int)_delay.TotalMilliseconds, (int)_period.TotalMilliseconds); + if (!ExecutionContext.IsFlowSuppressed()) + { + using (ExecutionContext.SuppressFlow()) + { + _timer = new Timer(ExecuteAsync, null, (int)_delay.TotalMilliseconds, (int)_period.TotalMilliseconds); + } + } + else + { + _timer = new Timer(ExecuteAsync, null, (int)_delay.TotalMilliseconds, (int)_period.TotalMilliseconds); + } + return Task.CompletedTask; } diff --git a/src/Umbraco.Infrastructure/Services/Implement/CacheInstructionService.cs b/src/Umbraco.Infrastructure/Services/Implement/CacheInstructionService.cs index a037cd1095..ef8acf135f 100644 --- a/src/Umbraco.Infrastructure/Services/Implement/CacheInstructionService.cs +++ b/src/Umbraco.Infrastructure/Services/Implement/CacheInstructionService.cs @@ -247,6 +247,13 @@ namespace Umbraco.Cms.Core.Services.Implement /// private bool TryDeserializeInstructions(CacheInstruction instruction, out JArray jsonInstructions) { + if (instruction.Instructions == null) + { + _logger.LogError("Failed to deserialize instructions ({DtoId}: 'null').", instruction.Id); + jsonInstructions = null; + return false; + } + try { jsonInstructions = JsonConvert.DeserializeObject(instruction.Instructions); From b3b4059ec880a623d7d64466b46a6550efe8dc14 Mon Sep 17 00:00:00 2001 From: vsilvar Date: Mon, 21 Mar 2022 15:34:04 +0100 Subject: [PATCH 11/41] Implemented PR suggestions - code simplification Co-authored-by: Ronald Barendse --- .../HostedServices/RecurringHostedServiceBase.cs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs b/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs index 1a69533f2d..3dda944a3e 100644 --- a/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs +++ b/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs @@ -40,14 +40,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices /// public Task StartAsync(CancellationToken cancellationToken) { - if (!ExecutionContext.IsFlowSuppressed()) - { - using (ExecutionContext.SuppressFlow()) - { - _timer = new Timer(ExecuteAsync, null, (int)_delay.TotalMilliseconds, (int)_period.TotalMilliseconds); - } - } - else + using (!ExecutionContext.IsFlowSuppressed() ? (IDisposable)ExecutionContext.SuppressFlow() : null) { _timer = new Timer(ExecuteAsync, null, (int)_delay.TotalMilliseconds, (int)_period.TotalMilliseconds); } From 59eee2e5dd6089344560a4f1a7bda90edbb0771f Mon Sep 17 00:00:00 2001 From: vsilvar Date: Mon, 21 Mar 2022 15:34:32 +0100 Subject: [PATCH 12/41] Implemented PR suggestions - is instead of equality operator Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com> --- .../Services/Implement/CacheInstructionService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Infrastructure/Services/Implement/CacheInstructionService.cs b/src/Umbraco.Infrastructure/Services/Implement/CacheInstructionService.cs index ef8acf135f..b4af98ad0a 100644 --- a/src/Umbraco.Infrastructure/Services/Implement/CacheInstructionService.cs +++ b/src/Umbraco.Infrastructure/Services/Implement/CacheInstructionService.cs @@ -247,7 +247,7 @@ namespace Umbraco.Cms.Core.Services.Implement /// private bool TryDeserializeInstructions(CacheInstruction instruction, out JArray jsonInstructions) { - if (instruction.Instructions == null) + if (instruction.Instructions is null) { _logger.LogError("Failed to deserialize instructions ({DtoId}: 'null').", instruction.Id); jsonInstructions = null; From 267df80161ed661747f7ae2359d7907121bb8f79 Mon Sep 17 00:00:00 2001 From: Vitor Rodrigues Date: Mon, 21 Mar 2022 16:03:16 +0100 Subject: [PATCH 13/41] Ensure exceptions are caught for all recurring hosted services --- .../HostedServices/ContentVersionCleanup.cs | 2 +- .../HostedServices/HealthCheckNotifier.cs | 1 + .../HostedServices/KeepAlive.cs | 2 +- .../HostedServices/LogScrubber.cs | 2 +- .../HostedServices/RecurringHostedServiceBase.cs | 14 +++++++++++--- .../HostedServices/ReportSiteTask.cs | 2 +- .../HostedServices/ScheduledPublishing.cs | 2 +- .../ServerRegistration/InstructionProcessTask.cs | 2 +- .../ServerRegistration/TouchServerTask.cs | 2 +- .../HostedServices/TempFileCleanup.cs | 2 +- 10 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/Umbraco.Infrastructure/HostedServices/ContentVersionCleanup.cs b/src/Umbraco.Infrastructure/HostedServices/ContentVersionCleanup.cs index 5f3aba5f3f..8c9f3223f0 100644 --- a/src/Umbraco.Infrastructure/HostedServices/ContentVersionCleanup.cs +++ b/src/Umbraco.Infrastructure/HostedServices/ContentVersionCleanup.cs @@ -32,7 +32,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices IContentVersionService service, IMainDom mainDom, IServerRoleAccessor serverRoleAccessor) - : base(TimeSpan.FromHours(1), TimeSpan.FromMinutes(3)) + : base(logger, TimeSpan.FromHours(1), TimeSpan.FromMinutes(1)) { _runtimeState = runtimeState; _logger = logger; diff --git a/src/Umbraco.Infrastructure/HostedServices/HealthCheckNotifier.cs b/src/Umbraco.Infrastructure/HostedServices/HealthCheckNotifier.cs index 6a0828fad3..e6d8e75304 100644 --- a/src/Umbraco.Infrastructure/HostedServices/HealthCheckNotifier.cs +++ b/src/Umbraco.Infrastructure/HostedServices/HealthCheckNotifier.cs @@ -61,6 +61,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices IProfilingLogger profilingLogger, ICronTabParser cronTabParser) : base( + logger, healthChecksSettings.Value.Notification.Period, healthChecksSettings.Value.GetNotificationDelay(cronTabParser, DateTime.Now, DefaultDelay)) { diff --git a/src/Umbraco.Infrastructure/HostedServices/KeepAlive.cs b/src/Umbraco.Infrastructure/HostedServices/KeepAlive.cs index 22160b8f6e..3233cfa8f2 100644 --- a/src/Umbraco.Infrastructure/HostedServices/KeepAlive.cs +++ b/src/Umbraco.Infrastructure/HostedServices/KeepAlive.cs @@ -49,7 +49,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices IProfilingLogger profilingLogger, IServerRoleAccessor serverRegistrar, IHttpClientFactory httpClientFactory) - : base(TimeSpan.FromMinutes(5), DefaultDelay) + : base(logger, TimeSpan.FromMinutes(5), DefaultDelay) { _hostingEnvironment = hostingEnvironment; _mainDom = mainDom; diff --git a/src/Umbraco.Infrastructure/HostedServices/LogScrubber.cs b/src/Umbraco.Infrastructure/HostedServices/LogScrubber.cs index 27d9c29e8d..79c1c4b8ea 100644 --- a/src/Umbraco.Infrastructure/HostedServices/LogScrubber.cs +++ b/src/Umbraco.Infrastructure/HostedServices/LogScrubber.cs @@ -48,7 +48,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices IScopeProvider scopeProvider, ILogger logger, IProfilingLogger profilingLogger) - : base(TimeSpan.FromHours(4), DefaultDelay) + : base(logger, TimeSpan.FromHours(4), DefaultDelay) { _mainDom = mainDom; _serverRegistrar = serverRegistrar; diff --git a/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs b/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs index 3dda944a3e..18fe9fc47f 100644 --- a/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs +++ b/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs @@ -5,6 +5,7 @@ using System; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; namespace Umbraco.Cms.Infrastructure.HostedServices { @@ -21,6 +22,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices /// protected static readonly TimeSpan DefaultDelay = TimeSpan.FromMinutes(3); + private readonly ILogger _logger; private TimeSpan _period; private readonly TimeSpan _delay; private Timer _timer; @@ -29,10 +31,12 @@ namespace Umbraco.Cms.Infrastructure.HostedServices /// /// Initializes a new instance of the class. /// - /// Timepsan representing how often the task should recur. - /// Timespan represeting the initial delay after application start-up before the first run of the task occurs. - protected RecurringHostedServiceBase(TimeSpan period, TimeSpan delay) + /// Logger. + /// Timespan representing how often the task should recur. + /// Timespan representing the initial delay after application start-up before the first run of the task occurs. + protected RecurringHostedServiceBase(ILogger logger, TimeSpan period, TimeSpan delay) { + _logger = logger; _period = period; _delay = delay; } @@ -65,6 +69,10 @@ namespace Umbraco.Cms.Infrastructure.HostedServices // Hat-tip: https://stackoverflow.com/a/14207615/489433 await PerformExecuteAsync(state); } + catch (Exception ex) + { + _logger.LogError(ex, "Unhandled exception in recurring hosted service {serviceName}.", GetType().Name); + } finally { // Resume now that the task is complete - Note we use period in both because we don't want to execute again after the delay. diff --git a/src/Umbraco.Infrastructure/HostedServices/ReportSiteTask.cs b/src/Umbraco.Infrastructure/HostedServices/ReportSiteTask.cs index cfce96281c..6e5d412e71 100644 --- a/src/Umbraco.Infrastructure/HostedServices/ReportSiteTask.cs +++ b/src/Umbraco.Infrastructure/HostedServices/ReportSiteTask.cs @@ -23,7 +23,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices public ReportSiteTask( ILogger logger, ITelemetryService telemetryService) - : base(TimeSpan.FromDays(1), TimeSpan.FromMinutes(1)) + : base(logger, TimeSpan.FromDays(1), TimeSpan.FromMinutes(1)) { _logger = logger; _telemetryService = telemetryService; diff --git a/src/Umbraco.Infrastructure/HostedServices/ScheduledPublishing.cs b/src/Umbraco.Infrastructure/HostedServices/ScheduledPublishing.cs index 429389273f..fd70c05fc1 100644 --- a/src/Umbraco.Infrastructure/HostedServices/ScheduledPublishing.cs +++ b/src/Umbraco.Infrastructure/HostedServices/ScheduledPublishing.cs @@ -71,7 +71,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices ILogger logger, IServerMessenger serverMessenger, IScopeProvider scopeProvider) - : base(TimeSpan.FromMinutes(1), DefaultDelay) + : base(logger, TimeSpan.FromMinutes(1), DefaultDelay) { _runtimeState = runtimeState; _mainDom = mainDom; diff --git a/src/Umbraco.Infrastructure/HostedServices/ServerRegistration/InstructionProcessTask.cs b/src/Umbraco.Infrastructure/HostedServices/ServerRegistration/InstructionProcessTask.cs index 43e2522efd..3aa49f3f71 100644 --- a/src/Umbraco.Infrastructure/HostedServices/ServerRegistration/InstructionProcessTask.cs +++ b/src/Umbraco.Infrastructure/HostedServices/ServerRegistration/InstructionProcessTask.cs @@ -30,7 +30,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices.ServerRegistration /// The typed logger. /// The configuration for global settings. public InstructionProcessTask(IRuntimeState runtimeState, IServerMessenger messenger, ILogger logger, IOptions globalSettings) - : base(globalSettings.Value.DatabaseServerMessenger.TimeBetweenSyncOperations, TimeSpan.FromMinutes(1)) + : base(logger, globalSettings.Value.DatabaseServerMessenger.TimeBetweenSyncOperations, TimeSpan.FromMinutes(1)) { _runtimeState = runtimeState; _messenger = messenger; diff --git a/src/Umbraco.Infrastructure/HostedServices/ServerRegistration/TouchServerTask.cs b/src/Umbraco.Infrastructure/HostedServices/ServerRegistration/TouchServerTask.cs index d54d67338e..5f20a3654e 100644 --- a/src/Umbraco.Infrastructure/HostedServices/ServerRegistration/TouchServerTask.cs +++ b/src/Umbraco.Infrastructure/HostedServices/ServerRegistration/TouchServerTask.cs @@ -44,7 +44,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices.ServerRegistration ILogger logger, IOptions globalSettings, IServerRoleAccessor serverRoleAccessor) - : base(globalSettings.Value.DatabaseServerRegistrar.WaitTimeBetweenCalls, TimeSpan.FromSeconds(15)) + : base(logger, globalSettings.Value.DatabaseServerRegistrar.WaitTimeBetweenCalls, TimeSpan.FromSeconds(15)) { _runtimeState = runtimeState; _serverRegistrationService = serverRegistrationService ?? throw new ArgumentNullException(nameof(serverRegistrationService)); diff --git a/src/Umbraco.Infrastructure/HostedServices/TempFileCleanup.cs b/src/Umbraco.Infrastructure/HostedServices/TempFileCleanup.cs index e59cca5fbd..8a2a312455 100644 --- a/src/Umbraco.Infrastructure/HostedServices/TempFileCleanup.cs +++ b/src/Umbraco.Infrastructure/HostedServices/TempFileCleanup.cs @@ -33,7 +33,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices /// Representation of the main application domain. /// The typed logger. public TempFileCleanup(IIOHelper ioHelper, IMainDom mainDom, ILogger logger) - : base(TimeSpan.FromMinutes(60), DefaultDelay) + : base(logger, TimeSpan.FromMinutes(60), DefaultDelay) { _ioHelper = ioHelper; _mainDom = mainDom; From fe1df8d4ea209e89f3bd4f79c1ffed533f235363 Mon Sep 17 00:00:00 2001 From: Nikolaj Geisle Date: Tue, 22 Mar 2022 13:47:58 +0100 Subject: [PATCH 14/41] Amend breaking change --- .../HostedServices/RecurringHostedServiceBase.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs b/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs index 18fe9fc47f..3ac04a73c6 100644 --- a/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs +++ b/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs @@ -4,8 +4,10 @@ using System; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; +using Umbraco.Cms.Web.Common.DependencyInjection; namespace Umbraco.Cms.Infrastructure.HostedServices { @@ -41,6 +43,13 @@ namespace Umbraco.Cms.Infrastructure.HostedServices _delay = delay; } + // Scheduled for removal in V11 + [Obsolete("Please use constructor that takes an ILogger instead")] + protected RecurringHostedServiceBase(TimeSpan period, TimeSpan delay) + : this(StaticServiceProvider.Instance.GetRequiredService(), period, delay) + { + } + /// public Task StartAsync(CancellationToken cancellationToken) { From 5a613bacf06fa4b5b1bfd3ecb0ab4e4ed4e7a9dc Mon Sep 17 00:00:00 2001 From: Nikolaj Geisle Date: Tue, 22 Mar 2022 14:09:47 +0100 Subject: [PATCH 15/41] Amend breaking change v2 --- .../RecurringHostedServiceBase.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs b/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs index 3ac04a73c6..14f779d079 100644 --- a/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs +++ b/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs @@ -24,7 +24,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices /// protected static readonly TimeSpan DefaultDelay = TimeSpan.FromMinutes(3); - private readonly ILogger _logger; + private readonly ILogger _logger; private TimeSpan _period; private readonly TimeSpan _delay; private Timer _timer; @@ -36,7 +36,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices /// Logger. /// Timespan representing how often the task should recur. /// Timespan representing the initial delay after application start-up before the first run of the task occurs. - protected RecurringHostedServiceBase(ILogger logger, TimeSpan period, TimeSpan delay) + protected RecurringHostedServiceBase(ILogger logger, TimeSpan period, TimeSpan delay) { _logger = logger; _period = period; @@ -46,7 +46,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices // Scheduled for removal in V11 [Obsolete("Please use constructor that takes an ILogger instead")] protected RecurringHostedServiceBase(TimeSpan period, TimeSpan delay) - : this(StaticServiceProvider.Instance.GetRequiredService(), period, delay) + : this(StaticServiceProvider.Instance.GetRequiredService().CreateLogger(), period, delay) { } @@ -80,7 +80,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices } catch (Exception ex) { - _logger.LogError(ex, "Unhandled exception in recurring hosted service {serviceName}.", GetType().Name); + _logger.LogError(ex, "Unhandled exception in recurring hosted service {serviceName}."); } finally { @@ -120,4 +120,14 @@ namespace Umbraco.Cms.Infrastructure.HostedServices GC.SuppressFinalize(this); } } + + public class RecurringHostedServiceBaseImpl : RecurringHostedServiceBase + { + + public RecurringHostedServiceBaseImpl(TimeSpan period, TimeSpan delay) : base(period, delay) + { + } + + public override Task PerformExecuteAsync(object state) => Task.CompletedTask; + } } From b55ee70fe84dcf279c2d05a102dd36f34dbd5ea0 Mon Sep 17 00:00:00 2001 From: Nikolaj Geisle Date: Tue, 22 Mar 2022 14:14:54 +0100 Subject: [PATCH 16/41] Switched from service location to StaticAplicationLogging --- .../HostedServices/RecurringHostedServiceBase.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs b/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs index 14f779d079..e78374205c 100644 --- a/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs +++ b/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs @@ -4,10 +4,9 @@ using System; using System.Threading; using System.Threading.Tasks; -using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; -using Umbraco.Cms.Web.Common.DependencyInjection; +using Umbraco.Cms.Core; namespace Umbraco.Cms.Infrastructure.HostedServices { @@ -46,7 +45,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices // Scheduled for removal in V11 [Obsolete("Please use constructor that takes an ILogger instead")] protected RecurringHostedServiceBase(TimeSpan period, TimeSpan delay) - : this(StaticServiceProvider.Instance.GetRequiredService().CreateLogger(), period, delay) + : this(StaticApplicationLogging.CreateLogger(), period, delay) { } From cca29bf723c622947f1c113782fee7fbbda3f606 Mon Sep 17 00:00:00 2001 From: Nikolaj Geisle Date: Tue, 22 Mar 2022 14:16:46 +0100 Subject: [PATCH 17/41] Don't commit test classes. --- .../HostedServices/RecurringHostedServiceBase.cs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs b/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs index e78374205c..a4ab41fd7a 100644 --- a/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs +++ b/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs @@ -119,14 +119,4 @@ namespace Umbraco.Cms.Infrastructure.HostedServices GC.SuppressFinalize(this); } } - - public class RecurringHostedServiceBaseImpl : RecurringHostedServiceBase - { - - public RecurringHostedServiceBaseImpl(TimeSpan period, TimeSpan delay) : base(period, delay) - { - } - - public override Task PerformExecuteAsync(object state) => Task.CompletedTask; - } } From fd701068ae4bfa7a80db4e3fb1e465551eac09d2 Mon Sep 17 00:00:00 2001 From: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com> Date: Tue, 22 Mar 2022 14:18:12 +0100 Subject: [PATCH 18/41] Update src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs Co-authored-by: Paul Johnson --- .../HostedServices/RecurringHostedServiceBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs b/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs index a4ab41fd7a..2b63f45734 100644 --- a/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs +++ b/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs @@ -23,7 +23,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices /// protected static readonly TimeSpan DefaultDelay = TimeSpan.FromMinutes(3); - private readonly ILogger _logger; + private readonly ILogger _logger; private TimeSpan _period; private readonly TimeSpan _delay; private Timer _timer; From c6bfc61909f81351d950d1439468bf3a1a7ed3b1 Mon Sep 17 00:00:00 2001 From: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com> Date: Tue, 22 Mar 2022 14:21:53 +0100 Subject: [PATCH 19/41] Update src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs Co-authored-by: Paul Johnson --- .../HostedServices/RecurringHostedServiceBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs b/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs index 2b63f45734..32e2ab188d 100644 --- a/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs +++ b/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs @@ -35,7 +35,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices /// Logger. /// Timespan representing how often the task should recur. /// Timespan representing the initial delay after application start-up before the first run of the task occurs. - protected RecurringHostedServiceBase(ILogger logger, TimeSpan period, TimeSpan delay) + protected RecurringHostedServiceBase(ILogger logger, TimeSpan period, TimeSpan delay) { _logger = logger; _period = period; From 3f7f2797a6cd0ef764bea5c3f5f87238d8fff0ab Mon Sep 17 00:00:00 2001 From: Nikolaj Geisle Date: Tue, 22 Mar 2022 14:52:39 +0100 Subject: [PATCH 20/41] Add CreateLogger method so we still can get types using the legacy ctor --- src/Umbraco.Core/StaticApplicationLogging.cs | 6 ++++++ .../HostedServices/RecurringHostedServiceBase.cs | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Core/StaticApplicationLogging.cs b/src/Umbraco.Core/StaticApplicationLogging.cs index e216011014..0f32075144 100644 --- a/src/Umbraco.Core/StaticApplicationLogging.cs +++ b/src/Umbraco.Core/StaticApplicationLogging.cs @@ -1,3 +1,4 @@ +using System; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; @@ -18,5 +19,10 @@ namespace Umbraco.Cms.Core { return _loggerFactory?.CreateLogger() ?? NullLoggerFactory.Instance.CreateLogger(); } + + public static ILogger CreateLogger(Type type) + { + return _loggerFactory?.CreateLogger(type) ?? NullLoggerFactory.Instance.CreateLogger(type); + } } } diff --git a/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs b/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs index 32e2ab188d..7686c357a4 100644 --- a/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs +++ b/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs @@ -45,8 +45,10 @@ namespace Umbraco.Cms.Infrastructure.HostedServices // Scheduled for removal in V11 [Obsolete("Please use constructor that takes an ILogger instead")] protected RecurringHostedServiceBase(TimeSpan period, TimeSpan delay) - : this(StaticApplicationLogging.CreateLogger(), period, delay) { + _period = period; + _delay = delay; + _logger = StaticApplicationLogging.CreateLogger(GetType()); } /// From 10ae51273166978f410e49590091ad4727da840b Mon Sep 17 00:00:00 2001 From: Nikolaj Geisle Date: Tue, 22 Mar 2022 15:12:51 +0100 Subject: [PATCH 21/41] Use ILoggerFactory instead of StaticApplicationLogging --- src/Umbraco.Core/StaticApplicationLogging.cs | 5 ----- .../HostedServices/RecurringHostedServiceBase.cs | 5 +++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Umbraco.Core/StaticApplicationLogging.cs b/src/Umbraco.Core/StaticApplicationLogging.cs index 0f32075144..73078b0f42 100644 --- a/src/Umbraco.Core/StaticApplicationLogging.cs +++ b/src/Umbraco.Core/StaticApplicationLogging.cs @@ -19,10 +19,5 @@ namespace Umbraco.Cms.Core { return _loggerFactory?.CreateLogger() ?? NullLoggerFactory.Instance.CreateLogger(); } - - public static ILogger CreateLogger(Type type) - { - return _loggerFactory?.CreateLogger(type) ?? NullLoggerFactory.Instance.CreateLogger(type); - } } } diff --git a/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs b/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs index 7686c357a4..d906738430 100644 --- a/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs +++ b/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs @@ -4,9 +4,10 @@ using System; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; -using Umbraco.Cms.Core; +using Umbraco.Cms.Web.Common.DependencyInjection; namespace Umbraco.Cms.Infrastructure.HostedServices { @@ -48,7 +49,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices { _period = period; _delay = delay; - _logger = StaticApplicationLogging.CreateLogger(GetType()); + _logger = StaticServiceProvider.Instance.GetRequiredService().CreateLogger(GetType()); } /// From 496e281f2a84bb55c6c638038986c79cf38e7b24 Mon Sep 17 00:00:00 2001 From: Nikolaj Geisle Date: Tue, 22 Mar 2022 15:34:27 +0100 Subject: [PATCH 22/41] Add back service name --- .../HostedServices/RecurringHostedServiceBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs b/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs index d906738430..c1c7cdf3cf 100644 --- a/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs +++ b/src/Umbraco.Infrastructure/HostedServices/RecurringHostedServiceBase.cs @@ -82,7 +82,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices } catch (Exception ex) { - _logger.LogError(ex, "Unhandled exception in recurring hosted service {serviceName}."); + _logger.LogError(ex, "Unhandled exception in recurring hosted service."); } finally { From 7114c564da5f0b753e2f42d01a4a1cf4e08d78fb Mon Sep 17 00:00:00 2001 From: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com> Date: Wed, 23 Mar 2022 08:27:48 +0100 Subject: [PATCH 23/41] Amend unintentional change --- .../HostedServices/ContentVersionCleanup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Infrastructure/HostedServices/ContentVersionCleanup.cs b/src/Umbraco.Infrastructure/HostedServices/ContentVersionCleanup.cs index 8c9f3223f0..d037c91d86 100644 --- a/src/Umbraco.Infrastructure/HostedServices/ContentVersionCleanup.cs +++ b/src/Umbraco.Infrastructure/HostedServices/ContentVersionCleanup.cs @@ -32,7 +32,7 @@ namespace Umbraco.Cms.Infrastructure.HostedServices IContentVersionService service, IMainDom mainDom, IServerRoleAccessor serverRoleAccessor) - : base(logger, TimeSpan.FromHours(1), TimeSpan.FromMinutes(1)) + : base(logger, TimeSpan.FromHours(1), TimeSpan.FromMinutes(3)) { _runtimeState = runtimeState; _logger = logger; From 538fb173c2121685fb9ac1f46547a97f80de473d Mon Sep 17 00:00:00 2001 From: PhyxionNL <7643972+PhyxionNL@users.noreply.github.com> Date: Wed, 23 Mar 2022 17:05:12 +0100 Subject: [PATCH 24/41] Fixes #11169 Should also be ported to v10. --- .../ModelsBuilder/InMemoryModelFactory.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.Common/ModelsBuilder/InMemoryModelFactory.cs b/src/Umbraco.Web.Common/ModelsBuilder/InMemoryModelFactory.cs index 44e08f0af1..419352c56c 100644 --- a/src/Umbraco.Web.Common/ModelsBuilder/InMemoryModelFactory.cs +++ b/src/Umbraco.Web.Common/ModelsBuilder/InMemoryModelFactory.cs @@ -799,8 +799,12 @@ namespace Umbraco.Cms.Web.Common.ModelsBuilder { if (disposing) { - _watcher.EnableRaisingEvents = false; - _watcher.Dispose(); + if (_watcher != null) + { + _watcher.EnableRaisingEvents = false; + _watcher.Dispose(); + } + _locker.Dispose(); } From b59493646358ec453c1e6446aecfcadf0f511169 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corn=C3=A9=20Hoskam?= Date: Sun, 27 Mar 2022 23:32:23 +0200 Subject: [PATCH 25/41] Update UmbracoProject.csproj (#12164) * Update UmbracoProject.csproj Changing the comment would make the intent of the comment more clear, as you cannot use InMemoryAuto on compiled Razor views, but you're still allowed to keep it as false if you're using a different ModelsBuilder mode. * Update UmbracoProject.csproj Hoping this kicks off the PR checks... --- build/templates/UmbracoProject/UmbracoProject.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/templates/UmbracoProject/UmbracoProject.csproj b/build/templates/UmbracoProject/UmbracoProject.csproj index 6b47686415..1f98d24041 100644 --- a/build/templates/UmbracoProject/UmbracoProject.csproj +++ b/build/templates/UmbracoProject/UmbracoProject.csproj @@ -31,7 +31,7 @@ true - + false false From 76c1bce7d77301ec9c601d0ac8782afdef24d549 Mon Sep 17 00:00:00 2001 From: Reiter Date: Sat, 26 Mar 2022 11:06:22 +0100 Subject: [PATCH 26/41] only show groups user has access to --- .../src/views/users/views/groups/groups.controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/users/views/groups/groups.controller.js b/src/Umbraco.Web.UI.Client/src/views/users/views/groups/groups.controller.js index 4b81e7c11c..f7e1590da8 100644 --- a/src/Umbraco.Web.UI.Client/src/views/users/views/groups/groups.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/users/views/groups/groups.controller.js @@ -26,7 +26,7 @@ userService.getCurrentUser().then(function(user) { currentUser = user; // Get usergroups - userGroupsResource.getUserGroups({ onlyCurrentUserGroups: false }).then(function (userGroups) { + userGroupsResource.getUserGroups().then(function (userGroups) { // only allow editing and selection if user is member of the group or admin vm.userGroups = _.map(userGroups, function (ug) { From 9203cffd27cacacdb1409a274a021a4a21f0d4f3 Mon Sep 17 00:00:00 2001 From: Ji Pattison-Smith Date: Tue, 29 Mar 2022 11:30:22 +0100 Subject: [PATCH 27/41] Pass culture code into GetAtRoot method in Siblings extensions to ensure the passed culture code is respected --- src/Umbraco.Core/Extensions/PublishedContentExtensions.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Core/Extensions/PublishedContentExtensions.cs b/src/Umbraco.Core/Extensions/PublishedContentExtensions.cs index 197f6f6d63..1731907be6 100644 --- a/src/Umbraco.Core/Extensions/PublishedContentExtensions.cs +++ b/src/Umbraco.Core/Extensions/PublishedContentExtensions.cs @@ -1082,7 +1082,7 @@ namespace Umbraco.Extensions { return content.Parent != null ? content.Parent.Children(variationContextAccessor, culture) - : publishedSnapshot.Content.GetAtRoot().WhereIsInvariantOrHasCulture(variationContextAccessor, culture); + : publishedSnapshot.Content.GetAtRoot(culture).WhereIsInvariantOrHasCulture(variationContextAccessor, culture); } /// @@ -1098,7 +1098,7 @@ namespace Umbraco.Extensions { return content.Parent != null ? content.Parent.ChildrenOfType(variationContextAccessor, contentTypeAlias, culture) - : publishedSnapshot.Content.GetAtRoot().OfTypes(contentTypeAlias).WhereIsInvariantOrHasCulture(variationContextAccessor, culture); + : publishedSnapshot.Content.GetAtRoot(culture).OfTypes(contentTypeAlias).WhereIsInvariantOrHasCulture(variationContextAccessor, culture); } /// @@ -1115,7 +1115,7 @@ namespace Umbraco.Extensions { return content.Parent != null ? content.Parent.Children(variationContextAccessor, culture) - : publishedSnapshot.Content.GetAtRoot().OfType().WhereIsInvariantOrHasCulture(variationContextAccessor, culture); + : publishedSnapshot.Content.GetAtRoot(culture).OfType().WhereIsInvariantOrHasCulture(variationContextAccessor, culture); } #endregion From db12594332bb11f453e3b0331028bf4b4954fe7e Mon Sep 17 00:00:00 2001 From: Marc Goodson Date: Wed, 30 Mar 2022 17:48:31 +0100 Subject: [PATCH 28/41] Making an update for appearances sake (#12199) * Update spelling of appearance in 'Editor appearance' key was incorrectly apperance * Update spelling of appearance in 'headlineEditorAppearance' key was incorrectly apperance --- src/Umbraco.Web.UI/umbraco/config/lang/en.xml | 2 +- src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml index 6b5d301c5f..f982f35769 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml @@ -2675,7 +2675,7 @@ To manage your website, simply open the Umbraco backoffice and start adding cont Create new Element Type Custom stylesheet Add stylesheet - Editor apperance + Editor appearance Data models Catalogue appearance Background color diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml index e056647ebc..2db73b4262 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml @@ -2764,7 +2764,7 @@ To manage your website, simply open the Umbraco backoffice and start adding cont Create new Element Type Custom stylesheet Add stylesheet - Editor apperance + Editor appearance Data models Catalogue appearance Background color From c218c068bd6b2bd3daad0e8c6938a9acd7ee344b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corn=C3=A9=20Hoskam?= Date: Thu, 31 Mar 2022 17:12:16 +0200 Subject: [PATCH 29/41] Update nl.xml --- src/Umbraco.Web.UI/umbraco/config/lang/nl.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/nl.xml b/src/Umbraco.Web.UI/umbraco/config/lang/nl.xml index d9ecc89673..8f94e8694d 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/nl.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/nl.xml @@ -82,6 +82,7 @@ Toegang toestaan om een node te vertalen Toegang toestaan om een node op te slaan Toegang toestaan om Inhoudssjabloon aan te maken + Toegang toestaan om meldingen voor content nodes aan te maken Inhoud @@ -256,6 +257,7 @@ Statistieken Titel (optioneel) Alternatieve tekst (optioneel) + Bijschrift (optioneel) Type Depubliceren Concept @@ -694,6 +696,7 @@ Wissen Sluiten Sluit venster + Sluit paneel Comment Bevestig Beperken @@ -2219,6 +2222,9 @@ Echter, Runway biedt een gemakkelijke basis om je snel op weg te helpen. Als je Geen relaties voor dit relatietype. Relatietype Relaties + Is Afhankelijkheid + Ja + Nee Aan de slag From 6eebd9660530076a27a0f442edd6c35cad964499 Mon Sep 17 00:00:00 2001 From: Reiter Date: Tue, 29 Mar 2022 18:29:50 +0200 Subject: [PATCH 30/41] add null check to multiurlpickervalueconverter IsValue() function umbraco#12186 --- .../ValueConverters/MultiUrlPickerValueConverter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/MultiUrlPickerValueConverter.cs b/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/MultiUrlPickerValueConverter.cs index 281f6c58eb..8b9093c1ca 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/MultiUrlPickerValueConverter.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/MultiUrlPickerValueConverter.cs @@ -41,7 +41,7 @@ namespace Umbraco.Cms.Core.PropertyEditors.ValueConverters public override PropertyCacheLevel GetPropertyCacheLevel(IPublishedPropertyType propertyType) => PropertyCacheLevel.Snapshot; - public override bool? IsValue(object value, PropertyValueLevel level) => value?.ToString() != "[]"; + public override bool? IsValue(object value, PropertyValueLevel level) => value != null && value.ToString() != "[]"; public override object ConvertSourceToIntermediate(IPublishedElement owner, IPublishedPropertyType propertyType, object source, bool preview) => source?.ToString(); From ddddaeb113ed79014fe28cc3e6066bcbf9db2e34 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 27 Mar 2022 21:32:57 +0000 Subject: [PATCH 31/41] Bump minimist from 1.2.5 to 1.2.6 in /tests/Umbraco.Tests.AcceptanceTest Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6. - [Release notes](https://github.com/substack/minimist/releases) - [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6) --- updated-dependencies: - dependency-name: minimist dependency-type: indirect ... Signed-off-by: dependabot[bot] --- tests/Umbraco.Tests.AcceptanceTest/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Umbraco.Tests.AcceptanceTest/package-lock.json b/tests/Umbraco.Tests.AcceptanceTest/package-lock.json index fb622bbffb..478f3cc53e 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/package-lock.json +++ b/tests/Umbraco.Tests.AcceptanceTest/package-lock.json @@ -1194,9 +1194,9 @@ } }, "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "dev": true }, "ms": { From 534ca928b48c625e65a2c4c7edda0565aef01a5d Mon Sep 17 00:00:00 2001 From: Bjarne Fyrstenborg Date: Sun, 3 Apr 2022 21:46:36 +0200 Subject: [PATCH 32/41] Use icon component for icons --- .../upload/umb-property-file-upload.html | 36 +++++++------------ .../src/views/packages/views/repo.html | 6 ++-- 2 files changed, 16 insertions(+), 26 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/components/upload/umb-property-file-upload.html b/src/Umbraco.Web.UI.Client/src/views/components/upload/umb-property-file-upload.html index a6df878997..f50722d421 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/upload/umb-property-file-upload.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/upload/umb-property-file-upload.html @@ -1,20 +1,17 @@ -
+
+ ng-required="vm.required && !vm.files.length" />
+ ng-hide="vm.files.length > 0">

Click to upload

- + +
@@ -25,38 +22,31 @@ source="file.fileSrc" name="file.fileName" client-side="file.isClientSide" - client-side-data="file.fileData" - > + client-side-data="file.fileData"> +
diff --git a/src/Umbraco.Web.UI.Client/src/views/packages/views/repo.html b/src/Umbraco.Web.UI.Client/src/views/packages/views/repo.html index 7dc3e499fe..f7e976de1e 100644 --- a/src/Umbraco.Web.UI.Client/src/views/packages/views/repo.html +++ b/src/Umbraco.Web.UI.Client/src/views/packages/views/repo.html @@ -300,9 +300,9 @@
External sources
From 057b304a5a95ed45892ff3aa06a0a87f6449edc9 Mon Sep 17 00:00:00 2001 From: Johannes Lantz Date: Mon, 4 Apr 2022 17:14:03 +0200 Subject: [PATCH 33/41] Added "move" action for dictionaries (#12193) * Added "move" action for dictionaries * Replaced DictionaryMove with MoveOrCopy for PostMove * Removed int parse for dictionary postmove id & parentId, changed paramtype for move in dictionary.resource * Added localizedText for new dictionary validationProblems & adjusted nullcheck for move.ParentId * Fixed logic for move dictionary parent --- .../Controllers/DictionaryController.cs | 35 ++++++++++ .../Trees/DictionaryTreeController.cs | 4 ++ .../common/resources/dictionary.resource.js | 45 ++++++++++++- .../src/views/dictionary/move.controller.js | 66 +++++++++++++++++++ .../src/views/dictionary/move.html | 53 +++++++++++++++ src/Umbraco.Web.UI/umbraco/config/lang/en.xml | 2 + .../umbraco/config/lang/en_us.xml | 2 + 7 files changed, 206 insertions(+), 1 deletion(-) create mode 100644 src/Umbraco.Web.UI.Client/src/views/dictionary/move.controller.js create mode 100644 src/Umbraco.Web.UI.Client/src/views/dictionary/move.html diff --git a/src/Umbraco.Web.BackOffice/Controllers/DictionaryController.cs b/src/Umbraco.Web.BackOffice/Controllers/DictionaryController.cs index 4d0e2cfe14..6710d61d14 100644 --- a/src/Umbraco.Web.BackOffice/Controllers/DictionaryController.cs +++ b/src/Umbraco.Web.BackOffice/Controllers/DictionaryController.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Net.Http; +using System.Net.Mime; +using System.Text; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; @@ -191,6 +193,39 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers return _umbracoMapper.Map(dictionary); } + /// + /// Changes the structure for dictionary items + /// + /// + /// + public IActionResult PostMove(MoveOrCopy move) + { + var dictionaryItem = _localizationService.GetDictionaryItemById(move.Id); + if (dictionaryItem == null) + return ValidationProblem(_localizedTextService.Localize("dictionary", "itemDoesNotExists")); + + var parent = _localizationService.GetDictionaryItemById(move.ParentId); + if (parent == null) + { + if (move.ParentId == Constants.System.Root) + dictionaryItem.ParentId = null; + else + return ValidationProblem(_localizedTextService.Localize("dictionary", "parentDoesNotExists")); + } + else + { + dictionaryItem.ParentId = parent.Key; + if (dictionaryItem.Key == parent.ParentId) + return ValidationProblem(_localizedTextService.Localize("moveOrCopy", "notAllowedByPath")); + } + + _localizationService.Save(dictionaryItem); + + var model = _umbracoMapper.Map(dictionaryItem); + + return Content(model.Path, MediaTypeNames.Text.Plain, Encoding.UTF8); + } + /// /// Saves a dictionary item /// diff --git a/src/Umbraco.Web.BackOffice/Trees/DictionaryTreeController.cs b/src/Umbraco.Web.BackOffice/Trees/DictionaryTreeController.cs index c61fabfa7b..bd7db36ba1 100644 --- a/src/Umbraco.Web.BackOffice/Trees/DictionaryTreeController.cs +++ b/src/Umbraco.Web.BackOffice/Trees/DictionaryTreeController.cs @@ -126,7 +126,11 @@ namespace Umbraco.Cms.Web.BackOffice.Trees menu.Items.Add(LocalizedTextService, opensDialog: true); if (id != Constants.System.RootString) + { menu.Items.Add(LocalizedTextService, true, opensDialog: true); + menu.Items.Add(LocalizedTextService, true, opensDialog: true); + } + menu.Items.Add(new RefreshNode(LocalizedTextService, true)); diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/dictionary.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/dictionary.resource.js index 3bb01fbe92..38a96fbcda 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/dictionary.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/dictionary.resource.js @@ -1,4 +1,4 @@ -/** +/** * @ngdoc service * @name umbraco.resources.dictionaryResource * @description Loads in data for dictionary items @@ -96,6 +96,48 @@ function dictionaryResource($q, $http, $location, umbRequestHelper, umbDataForma "Failed to get item " + id); } + /** + * @ngdoc method + * @name umbraco.resources.dictionaryResource#move + * @methodOf umbraco.resources.dictionaryResource + * + * @description + * Moves a dictionary item underneath a new parentId + * + * ##usage + *
+      * dictionaryResource.move({ parentId: 1244, id: 123 })
+      *    .then(function() {
+      *        alert("node was moved");
+      *    }, function(err){
+      *      alert("node didnt move:" + err.data.Message);
+      *    });
+      * 
+ * @param {Object} args arguments object + * @param {int} args.id the int of the dictionary item to move + * @param {int} args.parentId the int of the parent dictionary item to move to + * @returns {Promise} resourcePromise object. + * + */ + function move (args) { + if (!args) { + throw "args cannot be null"; + } + if (!args.parentId) { + throw "args.parentId cannot be null"; + } + if (!args.id) { + throw "args.id cannot be null"; + } + + return umbRequestHelper.resourcePromise( + $http.post(umbRequestHelper.getApiUrl("dictionaryApiBaseUrl", "PostMove"), + { + parentId: args.parentId, + id: args.id + }, { responseType: 'text' })); + } + /** * @ngdoc method * @name umbraco.resources.dictionaryResource#save @@ -151,6 +193,7 @@ function dictionaryResource($q, $http, $location, umbRequestHelper, umbDataForma create: create, getById: getById, save: save, + move: move, getList : getList }; diff --git a/src/Umbraco.Web.UI.Client/src/views/dictionary/move.controller.js b/src/Umbraco.Web.UI.Client/src/views/dictionary/move.controller.js new file mode 100644 index 0000000000..a99f09af21 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/dictionary/move.controller.js @@ -0,0 +1,66 @@ +angular.module("umbraco") + .controller("Umbraco.Editors.Dictionary.MoveController", + function ($scope, dictionaryResource, treeService, navigationService, notificationsService, appState, eventsService) { + + $scope.dialogTreeApi = {}; + $scope.source = _.clone($scope.currentNode); + + function nodeSelectHandler(args) { + args.event.preventDefault(); + args.event.stopPropagation(); + + if ($scope.target) { + //un-select if there's a current one selected + $scope.target.selected = false; + } + $scope.target = args.node; + $scope.target.selected = true; + } + + $scope.move = function () { + + $scope.busy = true; + $scope.error = false; + + dictionaryResource.move({ parentId: $scope.target.id, id: $scope.source.id }) + .then(function (path) { + $scope.error = false; + $scope.success = true; + $scope.busy = false; + + //first we need to remove the node that launched the dialog + treeService.removeNode($scope.currentNode); + + //get the currently edited node (if any) + var activeNode = appState.getTreeState("selectedNode"); + + //we need to do a double sync here: first sync to the moved content - but don't activate the node, + //then sync to the currenlty edited content (note: this might not be the content that was moved!!) + + navigationService.syncTree({ tree: "dictionary", path: path, forceReload: true, activate: false }).then(function (args) { + if (activeNode) { + var activeNodePath = treeService.getPath(activeNode).join(); + //sync to this node now - depending on what was copied this might already be synced but might not be + navigationService.syncTree({ tree: "dictionary", path: activeNodePath, forceReload: false, activate: true }); + } + }); + + eventsService.emit('app.refreshEditor'); + + }, function (err) { + $scope.success = false; + $scope.error = err; + $scope.busy = false; + + }); + }; + + $scope.onTreeInit = function () { + $scope.dialogTreeApi.callbacks.treeNodeSelect(nodeSelectHandler); + }; + + $scope.close = function() { + navigationService.hideDialog(); + }; + + }); diff --git a/src/Umbraco.Web.UI.Client/src/views/dictionary/move.html b/src/Umbraco.Web.UI.Client/src/views/dictionary/move.html new file mode 100644 index 0000000000..d8accbb5d5 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/dictionary/move.html @@ -0,0 +1,53 @@ +
+ +
+
+ +

+ Choose where to move {{source.name}} to in the tree structure below +

+ + + +
+
+
{{error.errorMsg}}
+
{{error.data.message}}
+
+
+ +
+
+ {{source.name}} was moved underneath {{target.name}} +
+ +
+ +
+ +
+ + +
+ +
+
+
+ + +
diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml index f982f35769..7140d0850a 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml @@ -569,6 +569,8 @@ Modifying layout will result in loss of data for any existing content that is based on this configuration. + Dictionary item does not exist. + Parent item does not exist. There are no dictionary items. Create dictionary item diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml index 2db73b4262..8111463e68 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml @@ -579,6 +579,8 @@ Modifying layout will result in loss of data for any existing content that is based on this configuration. + Dictionary item does not exist. + Parent item does not exist. There are no dictionary items. Create dictionary item From 45e7c10cb83b48bff672ff12633dff97de146f3e Mon Sep 17 00:00:00 2001 From: Nathan Woulfe Date: Tue, 5 Apr 2022 08:14:17 +1000 Subject: [PATCH 34/41] busfy => busy --- src/Umbraco.Web.UI.Client/src/views/users/user.controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/users/user.controller.js b/src/Umbraco.Web.UI.Client/src/views/users/user.controller.js index 79164a2457..684ce6d2f0 100644 --- a/src/Umbraco.Web.UI.Client/src/views/users/user.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/users/user.controller.js @@ -374,7 +374,7 @@ } function enableUser() { - vm.enableUserButtonState = "busfy"; + vm.enableUserButtonState = "busy"; usersResource.enableUsers([vm.user.id]).then(function (data) { vm.user.userState = "Active"; setUserDisplayState(); From 6423529dd0abb7c5755980fde62cac5f5bfc802f Mon Sep 17 00:00:00 2001 From: Nathan Woulfe Date: Mon, 4 Apr 2022 09:22:38 +1000 Subject: [PATCH 35/41] ensure proper cleanup to avoid lingering scopes causing memory leaks --- .../src/common/services/tinymce.service.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js b/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js index 98543a7c68..3273b8a2fb 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js @@ -1599,6 +1599,11 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s syncContent(); }); + // When the element is removed from the DOM, we need to terminate + // any active watchers to ensure scopes are disposed and do not leak. + // No need to sync content as that has already happened. + args.editor.on('remove', () => stopWatch()); + args.editor.on('ObjectResized', function (e) { var srcAttr = $(e.target).attr("src"); var path = srcAttr.split("?")[0]; From 7d8a07e703cc87c1fc14b912bbbef0df790c6a0f Mon Sep 17 00:00:00 2001 From: Jeavon Date: Wed, 6 Apr 2022 00:35:53 +0100 Subject: [PATCH 36/41] Fix KeepAlive Config so that value from appsettings.json is used (#12224) * Fix KeepAlive Config so that value from appsettings.json is used if present * update comment to reflect get-set on KeepAlivePingUrl Co-authored-by: Nathan Woulfe --- src/Umbraco.Core/Configuration/Models/KeepAliveSettings.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Core/Configuration/Models/KeepAliveSettings.cs b/src/Umbraco.Core/Configuration/Models/KeepAliveSettings.cs index 305df2be8c..297e1dff87 100644 --- a/src/Umbraco.Core/Configuration/Models/KeepAliveSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/KeepAliveSettings.cs @@ -12,6 +12,7 @@ namespace Umbraco.Cms.Core.Configuration.Models public class KeepAliveSettings { internal const bool StaticDisableKeepAliveTask = false; + internal const string StaticKeepAlivePingUrl = "~/api/keepalive/ping"; /// /// Gets or sets a value indicating whether the keep alive task is disabled. @@ -20,8 +21,9 @@ namespace Umbraco.Cms.Core.Configuration.Models public bool DisableKeepAliveTask { get; set; } = StaticDisableKeepAliveTask; /// - /// Gets a value for the keep alive ping URL. + /// Gets or sets a value for the keep alive ping URL. /// - public string KeepAlivePingUrl => "~/api/keepalive/ping"; + [DefaultValue(StaticKeepAlivePingUrl)] + public string KeepAlivePingUrl { get; set; } = StaticKeepAlivePingUrl; } } From 597d28b3991344dbb7b34c602531d0c964670ee0 Mon Sep 17 00:00:00 2001 From: patrickdemooij9 Date: Tue, 5 Apr 2022 11:55:11 +0200 Subject: [PATCH 37/41] Remove statuscodepages middleware --- .../ApplicationBuilder/UmbracoApplicationBuilder.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Umbraco.Web.Common/ApplicationBuilder/UmbracoApplicationBuilder.cs b/src/Umbraco.Web.Common/ApplicationBuilder/UmbracoApplicationBuilder.cs index 58f66a6fb8..a62f00c54f 100644 --- a/src/Umbraco.Web.Common/ApplicationBuilder/UmbracoApplicationBuilder.cs +++ b/src/Umbraco.Web.Common/ApplicationBuilder/UmbracoApplicationBuilder.cs @@ -92,8 +92,6 @@ namespace Umbraco.Cms.Web.Common.ApplicationBuilder { UseUmbracoCoreMiddleware(); - AppBuilder.UseStatusCodePages(); - // Important we handle image manipulations before the static files, otherwise the querystring is just ignored. AppBuilder.UseImageSharp(); From 5bac054311dc9a200e9f1a39a6b5cdb30161ec4f Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Thu, 7 Apr 2022 16:36:30 +0200 Subject: [PATCH 38/41] Add discord badge --- .github/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/README.md b/.github/README.md index 95ba778db2..5fa412cae4 100644 --- a/.github/README.md +++ b/.github/README.md @@ -1,4 +1,4 @@ -# [Umbraco CMS](https://umbraco.com) · [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](../LICENSE.md) [![Build status](https://umbraco.visualstudio.com/Umbraco%20Cms/_apis/build/status/Cms%208%20Continuous?branchName=v8/contrib)](https://umbraco.visualstudio.com/Umbraco%20Cms/_build?definitionId=75) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md) [![Twitter](https://img.shields.io/twitter/follow/umbraco.svg?style=social&label=Follow)](https://twitter.com/intent/follow?screen_name=umbraco) +# [Umbraco CMS](https://umbraco.com) · [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](../LICENSE.md) [![Build status](https://umbraco.visualstudio.com/Umbraco%20Cms/_apis/build/status/Cms%208%20Continuous?branchName=v8/contrib)](https://umbraco.visualstudio.com/Umbraco%20Cms/_build?definitionId=75) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md) [![Twitter](https://img.shields.io/twitter/follow/umbraco.svg?style=social&label=Follow)](https://twitter.com/intent/follow?screen_name=umbraco) [![Discord](https://img.shields.io/discord/869656431308189746)](https://discord.gg/umbraco) Umbraco is the friendliest, most flexible and fastest growing ASP.NET CMS, and used by more than 500,000 websites worldwide. Our mission is to help you deliver delightful digital experiences by making Umbraco friendly, simpler and social. From 75613cf06174ecdd39f53d332598c1346a3df631 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Tue, 12 Apr 2022 13:45:15 +0200 Subject: [PATCH 39/41] Revert "Block List Settings throws exception if Models builder mode is set to "Nothing" (#11725)" This reverts commit 62b289e1790c721bb9bc3c717c21a4d13de7a173. --- .../BlockListPropertyValueConverter.cs | 15 +-------------- .../BlockListPropertyValueConverterTests.cs | 5 +---- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/BlockListPropertyValueConverter.cs b/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/BlockListPropertyValueConverter.cs index 1c8c7c7d4f..6916f2ea3f 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/BlockListPropertyValueConverter.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/ValueConverters/BlockListPropertyValueConverter.cs @@ -4,14 +4,9 @@ using System; using System.Collections.Generic; using System.Linq; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Options; -using Umbraco.Cms.Core.Configuration; -using Umbraco.Cms.Core.Configuration.Models; using Umbraco.Cms.Core.Logging; using Umbraco.Cms.Core.Models.Blocks; using Umbraco.Cms.Core.Models.PublishedContent; -using Umbraco.Cms.Web.Common.DependencyInjection; using Umbraco.Extensions; namespace Umbraco.Cms.Core.PropertyEditors.ValueConverters @@ -22,20 +17,12 @@ namespace Umbraco.Cms.Core.PropertyEditors.ValueConverters private readonly IProfilingLogger _proflog; private readonly BlockEditorConverter _blockConverter; private readonly BlockListEditorDataConverter _blockListEditorDataConverter; - private readonly ModelsBuilderSettings _modelsBuilderSettings; - [Obsolete("Use ctor injecting ModelsBuilderSettings")] public BlockListPropertyValueConverter(IProfilingLogger proflog, BlockEditorConverter blockConverter) - : this(proflog, blockConverter,StaticServiceProvider.Instance.GetRequiredService>()) - { - } - - public BlockListPropertyValueConverter(IProfilingLogger proflog, BlockEditorConverter blockConverter, IOptions modelsBuilderOptions) { _proflog = proflog; _blockConverter = blockConverter; _blockListEditorDataConverter = new BlockListEditorDataConverter(); - _modelsBuilderSettings = modelsBuilderOptions?.Value; } /// @@ -129,7 +116,7 @@ namespace Umbraco.Cms.Core.PropertyEditors.ValueConverters } // Get settings type from configuration - var settingsType = blockConfig.SettingsElementTypeKey.HasValue && _modelsBuilderSettings.ModelsMode != ModelsMode.Nothing + var settingsType = blockConfig.SettingsElementTypeKey.HasValue ? _blockConverter.GetModelType(blockConfig.SettingsElementTypeKey.Value) : typeof(IPublishedElement); diff --git a/tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/BlockListPropertyValueConverterTests.cs b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/BlockListPropertyValueConverterTests.cs index 09fc427d12..084bf03370 100644 --- a/tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/BlockListPropertyValueConverterTests.cs +++ b/tests/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/BlockListPropertyValueConverterTests.cs @@ -2,11 +2,9 @@ // See LICENSE for more details. using System; -using Microsoft.Extensions.Options; using Moq; using NUnit.Framework; using Umbraco.Cms.Core; -using Umbraco.Cms.Core.Configuration.Models; using Umbraco.Cms.Core.Logging; using Umbraco.Cms.Core.Models.Blocks; using Umbraco.Cms.Core.Models.PublishedContent; @@ -64,10 +62,9 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.PropertyEditors { IPublishedSnapshotAccessor publishedSnapshotAccessor = GetPublishedSnapshotAccessor(); var publishedModelFactory = new NoopPublishedModelFactory(); - var modelsBuilderSettings = Mock.Of>(x => x.Value == new ModelsBuilderSettings()); var editor = new BlockListPropertyValueConverter( Mock.Of(), - new BlockEditorConverter(publishedSnapshotAccessor, publishedModelFactory), modelsBuilderSettings); + new BlockEditorConverter(publishedSnapshotAccessor, publishedModelFactory)); return editor; } From faa561da2bb0fc8facb552ae2c9ec81188865250 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Thu, 14 Apr 2022 10:06:01 +0200 Subject: [PATCH 40/41] Fixes error on first running the Web.UI because of an invalid config --- src/Umbraco.Web.UI/appsettings.template.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI/appsettings.template.json b/src/Umbraco.Web.UI/appsettings.template.json index cef926fad2..e9a69481d6 100644 --- a/src/Umbraco.Web.UI/appsettings.template.json +++ b/src/Umbraco.Web.UI/appsettings.template.json @@ -33,7 +33,7 @@ }, "KeepAlive": { "DisableKeepAliveTask": false, - "KeepAlivePingUrl": "{umbracoApplicationUrl}/api/keepalive/ping" + "KeepAlivePingUrl": "~/{umbracoApplicationUrl}/api/keepalive/ping" }, "RequestHandler": { "ConvertUrlsToAscii": "try" From 70a48596baef47d0b558db57b0910204685a701c Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Thu, 14 Apr 2022 10:39:30 +0200 Subject: [PATCH 41/41] The `{umbracoApplicationUrl}` magic string does nothing here --- src/Umbraco.Web.UI/appsettings.template.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI/appsettings.template.json b/src/Umbraco.Web.UI/appsettings.template.json index e9a69481d6..2a291c5bc6 100644 --- a/src/Umbraco.Web.UI/appsettings.template.json +++ b/src/Umbraco.Web.UI/appsettings.template.json @@ -33,7 +33,7 @@ }, "KeepAlive": { "DisableKeepAliveTask": false, - "KeepAlivePingUrl": "~/{umbracoApplicationUrl}/api/keepalive/ping" + "KeepAlivePingUrl": "~/api/keepalive/ping" }, "RequestHandler": { "ConvertUrlsToAscii": "try"