From 9cb59fe1b4c73c931148f24b35917ca711cf3b7b Mon Sep 17 00:00:00 2001 From: Andy Butland Date: Wed, 22 Oct 2025 16:42:12 +0200 Subject: [PATCH 1/7] Bumped version to 16.3.3. --- src/Umbraco.Web.UI.Client/package.json | 2 +- version.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/package.json b/src/Umbraco.Web.UI.Client/package.json index 74bf09f5a9..bbdb094513 100644 --- a/src/Umbraco.Web.UI.Client/package.json +++ b/src/Umbraco.Web.UI.Client/package.json @@ -1,7 +1,7 @@ { "name": "@umbraco-cms/backoffice", "license": "MIT", - "version": "16.3.2", + "version": "16.3.3", "type": "module", "exports": { ".": null, diff --git a/version.json b/version.json index 7167818c6d..eb6387dfd6 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json", - "version": "16.3.2", + "version": "16.3.3", "assemblyVersion": { "precision": "build" }, From a09e1777c4604d2b6b7a6c9616764c7a6522cedd Mon Sep 17 00:00:00 2001 From: Andy Butland Date: Wed, 22 Oct 2025 12:21:42 +0200 Subject: [PATCH 2/7] Migrations: Use reliable GUID to check for existence of data type when creating (#20604) * Use reliable GUID to check for existence of data type in migration. * Retrieve just a single field in existence check. --- .../MigrateMediaTypeLabelProperties.cs | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_16_3_0/MigrateMediaTypeLabelProperties.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_16_3_0/MigrateMediaTypeLabelProperties.cs index efa48f00f2..71c824f357 100644 --- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_16_3_0/MigrateMediaTypeLabelProperties.cs +++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_16_3_0/MigrateMediaTypeLabelProperties.cs @@ -6,7 +6,9 @@ using Umbraco.Cms.Core.Configuration.Models; using Umbraco.Cms.Core.Models; using Umbraco.Cms.Core.Services; using Umbraco.Cms.Core.Services.OperationStatus; +using Umbraco.Cms.Infrastructure.Persistence; using Umbraco.Cms.Infrastructure.Persistence.Dtos; +using Umbraco.Extensions; namespace Umbraco.Cms.Infrastructure.Migrations.Upgrade.V_16_3_0; @@ -69,7 +71,7 @@ public class MigrateMediaTypeLabelProperties : AsyncMigrationBase private void IfNotExistsCreateBytesLabel() { - if (Database.Exists(Constants.DataTypes.LabelBytes)) + if (NodeExists(_labelBytesDataTypeKey)) { return; } @@ -89,7 +91,7 @@ public class MigrateMediaTypeLabelProperties : AsyncMigrationBase CreateDate = DateTime.Now, }; - _ = Database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, nodeDto); + Database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, nodeDto); var dataTypeDto = new DataTypeDto { @@ -100,12 +102,12 @@ public class MigrateMediaTypeLabelProperties : AsyncMigrationBase Configuration = "{\"umbracoDataValueType\":\"BIGINT\", \"labelTemplate\":\"{=value | bytes}\"}", }; - _ = Database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, dataTypeDto); + Database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, dataTypeDto); } private void IfNotExistsCreatePixelsLabel() { - if (Database.Exists(Constants.DataTypes.LabelPixels)) + if (NodeExists(_labelPixelsDataTypeKey)) { return; } @@ -125,7 +127,7 @@ public class MigrateMediaTypeLabelProperties : AsyncMigrationBase CreateDate = DateTime.Now, }; - _ = Database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, nodeDto); + Database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, nodeDto); var dataTypeDto = new DataTypeDto { @@ -136,7 +138,16 @@ public class MigrateMediaTypeLabelProperties : AsyncMigrationBase Configuration = "{\"umbracoDataValueType\":\"INT\", \"labelTemplate\":\"{=value}px\"}", }; - _ = Database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, dataTypeDto); + Database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, dataTypeDto); + } + + private bool NodeExists(Guid uniqueId) + { + Sql sql = Database.SqlContext.Sql() + .Select(x => x.NodeId) + .From() + .Where(x => x.UniqueId == uniqueId); + return Database.FirstOrDefault(sql) is not null; } private async Task MigrateMediaTypeLabels() From 644334c63b79802b641fc2d63534e0ef337617f4 Mon Sep 17 00:00:00 2001 From: Andy Butland Date: Wed, 22 Oct 2025 16:20:20 +0200 Subject: [PATCH 3/7] Trees: Restore backward compatibility for file system based tree controllers (closes #20602) (#20608) * Restore backward compatibility for file system based tree controllers. * Aligned obsoletion messages. --- .../AncestorsPartialViewTreeController.cs | 28 +++---- .../Tree/ChildrenPartialViewTreeController.cs | 29 ++++--- .../Tree/PartialViewTreeControllerBase.cs | 22 +++-- .../Tree/RootPartialViewTreeController.cs | 29 ++++--- .../Tree/SiblingsPartialViewTreeController.cs | 27 +++---- .../Tree/AncestorsScriptTreeController.cs | 27 +++---- .../Tree/ChildrenScriptTreeController.cs | 29 ++++--- .../Script/Tree/RootScriptTreeController.cs | 29 ++++--- .../Script/Tree/ScriptTreeControllerBase.cs | 22 +++-- .../Tree/SiblingsScriptTreeController.cs | 27 +++---- .../Tree/AncestorsStylesheetTreeController.cs | 27 +++---- .../Tree/ChildrenStylesheetTreeController.cs | 34 ++++---- .../Tree/RootStylesheetTreeController.cs | 29 ++++--- .../Tree/SiblingsStylesheetTreeController.cs | 27 +++---- .../Tree/StylesheetTreeControllerBase.cs | 20 ++--- .../Tree/FileSystemTreeControllerBase.cs | 81 ++++++++++++++----- 16 files changed, 251 insertions(+), 236 deletions(-) diff --git a/src/Umbraco.Cms.Api.Management/Controllers/PartialView/Tree/AncestorsPartialViewTreeController.cs b/src/Umbraco.Cms.Api.Management/Controllers/PartialView/Tree/AncestorsPartialViewTreeController.cs index 3f79545e39..6f30a72684 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/PartialView/Tree/AncestorsPartialViewTreeController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/PartialView/Tree/AncestorsPartialViewTreeController.cs @@ -1,34 +1,32 @@ -using Asp.Versioning; +using Asp.Versioning; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; using Umbraco.Cms.Api.Management.Services.FileSystem; using Umbraco.Cms.Api.Management.ViewModels.Tree; -using Umbraco.Cms.Core.DependencyInjection; using Umbraco.Cms.Core.IO; -using Umbraco.Cms.Core.Services; namespace Umbraco.Cms.Api.Management.Controllers.PartialView.Tree; [ApiVersion("1.0")] public class AncestorsPartialViewTreeController : PartialViewTreeControllerBase { - private readonly IPartialViewTreeService _partialViewTreeService; - // TODO Remove the static service provider, and replace with base when the other constructors are obsoleted. - public AncestorsPartialViewTreeController(IPartialViewTreeService partialViewTreeService) - : this(partialViewTreeService, StaticServiceProvider.Instance.GetRequiredService()) - => _partialViewTreeService = partialViewTreeService; - [ActivatorUtilitiesConstructor] - [Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")] - public AncestorsPartialViewTreeController(IPartialViewTreeService partialViewTreeService, FileSystems fileSystems) - : base(partialViewTreeService, fileSystems) => - _partialViewTreeService = partialViewTreeService; + public AncestorsPartialViewTreeController(IPartialViewTreeService partialViewTreeService) + : base(partialViewTreeService) + { + } - [Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")] + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] + public AncestorsPartialViewTreeController(IPartialViewTreeService partialViewTreeService, FileSystems fileSystems) + : base(partialViewTreeService, fileSystems) + { + } + + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] public AncestorsPartialViewTreeController(FileSystems fileSystems) - : this(StaticServiceProvider.Instance.GetRequiredService(), fileSystems) + : base(fileSystems) { } diff --git a/src/Umbraco.Cms.Api.Management/Controllers/PartialView/Tree/ChildrenPartialViewTreeController.cs b/src/Umbraco.Cms.Api.Management/Controllers/PartialView/Tree/ChildrenPartialViewTreeController.cs index 099f01f342..9c70e7acbe 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/PartialView/Tree/ChildrenPartialViewTreeController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/PartialView/Tree/ChildrenPartialViewTreeController.cs @@ -1,34 +1,33 @@ -using Asp.Versioning; +using Asp.Versioning; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; -using Umbraco.Cms.Core.IO; using Umbraco.Cms.Api.Common.ViewModels.Pagination; using Umbraco.Cms.Api.Management.Services.FileSystem; using Umbraco.Cms.Api.Management.ViewModels.Tree; -using Umbraco.Cms.Core.DependencyInjection; +using Umbraco.Cms.Core.IO; namespace Umbraco.Cms.Api.Management.Controllers.PartialView.Tree; [ApiVersion("1.0")] public class ChildrenPartialViewTreeController : PartialViewTreeControllerBase { - private readonly IPartialViewTreeService _partialViewTreeService; - // TODO Remove the static service provider, and replace with base when the other constructors are obsoleted. - public ChildrenPartialViewTreeController(IPartialViewTreeService partialViewTreeService) - : this(partialViewTreeService, StaticServiceProvider.Instance.GetRequiredService()) - => _partialViewTreeService = partialViewTreeService; - [ActivatorUtilitiesConstructor] - [Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")] - public ChildrenPartialViewTreeController(IPartialViewTreeService partialViewTreeService, FileSystems fileSystems) - : base(partialViewTreeService, fileSystems) => - _partialViewTreeService = partialViewTreeService; + public ChildrenPartialViewTreeController(IPartialViewTreeService partialViewTreeService) + : base(partialViewTreeService) + { + } - [Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")] + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] + public ChildrenPartialViewTreeController(IPartialViewTreeService partialViewTreeService, FileSystems fileSystems) + : base(partialViewTreeService, fileSystems) + { + } + + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] public ChildrenPartialViewTreeController(FileSystems fileSystems) - : this(StaticServiceProvider.Instance.GetRequiredService(), fileSystems) + : base(fileSystems) { } diff --git a/src/Umbraco.Cms.Api.Management/Controllers/PartialView/Tree/PartialViewTreeControllerBase.cs b/src/Umbraco.Cms.Api.Management/Controllers/PartialView/Tree/PartialViewTreeControllerBase.cs index 6875e395f6..5f50a09898 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/PartialView/Tree/PartialViewTreeControllerBase.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/PartialView/Tree/PartialViewTreeControllerBase.cs @@ -1,11 +1,9 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.DependencyInjection; using Umbraco.Cms.Api.Management.Controllers.Tree; using Umbraco.Cms.Api.Management.Routing; using Umbraco.Cms.Api.Management.Services.FileSystem; using Umbraco.Cms.Core; -using Umbraco.Cms.Core.DependencyInjection; using Umbraco.Cms.Core.IO; using Umbraco.Cms.Web.Common.Authorization; @@ -16,30 +14,28 @@ namespace Umbraco.Cms.Api.Management.Controllers.PartialView.Tree; [Authorize(Policy = AuthorizationPolicies.TreeAccessPartialViews)] public class PartialViewTreeControllerBase : FileSystemTreeControllerBase { - private readonly IPartialViewTreeService _partialViewTreeService; - // TODO Remove the static service provider, and replace with base when the other constructors are obsoleted. public PartialViewTreeControllerBase(IPartialViewTreeService partialViewTreeService) - : this(partialViewTreeService, StaticServiceProvider.Instance.GetRequiredService()) => - _partialViewTreeService = partialViewTreeService; + : base(partialViewTreeService) + { + FileSystem = null!; + } - // FileSystem is required therefore, we can't remove it without some wizadry. When obsoletion is due, remove this. - [ActivatorUtilitiesConstructor] - [Obsolete("Scheduled for removal in Umbraco 18.")] + // FileSystem is required therefore, we can't remove it without some wizardry. When obsoletion is due, remove this. + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] public PartialViewTreeControllerBase(IPartialViewTreeService partialViewTreeService, FileSystems fileSystems) : base(partialViewTreeService) { - _partialViewTreeService = partialViewTreeService; FileSystem = fileSystems.PartialViewsFileSystem ?? throw new ArgumentException("Missing scripts file system", nameof(fileSystems)); } - [Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 18.")] + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] public PartialViewTreeControllerBase(FileSystems fileSystems) - : this(StaticServiceProvider.Instance.GetRequiredService()) + : base() => FileSystem = fileSystems.PartialViewsFileSystem ?? throw new ArgumentException("Missing scripts file system", nameof(fileSystems)); - [Obsolete("Included in the service class. Scheduled to be removed in Umbraco 18.")] + [Obsolete("Included in the service class. Scheduled to be removed in Umbraco 19.")] protected override IFileSystem FileSystem { get; } } diff --git a/src/Umbraco.Cms.Api.Management/Controllers/PartialView/Tree/RootPartialViewTreeController.cs b/src/Umbraco.Cms.Api.Management/Controllers/PartialView/Tree/RootPartialViewTreeController.cs index 4e42266389..0a7d95627f 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/PartialView/Tree/RootPartialViewTreeController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/PartialView/Tree/RootPartialViewTreeController.cs @@ -1,34 +1,33 @@ -using Asp.Versioning; +using Asp.Versioning; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; -using Umbraco.Cms.Core.IO; using Umbraco.Cms.Api.Common.ViewModels.Pagination; using Umbraco.Cms.Api.Management.Services.FileSystem; using Umbraco.Cms.Api.Management.ViewModels.Tree; -using Umbraco.Cms.Core.DependencyInjection; +using Umbraco.Cms.Core.IO; namespace Umbraco.Cms.Api.Management.Controllers.PartialView.Tree; [ApiVersion("1.0")] public class RootPartialViewTreeController : PartialViewTreeControllerBase { - private readonly IPartialViewTreeService _partialViewTreeService; - // TODO Remove the static service provider, and replace with base when the other constructors are obsoleted. - public RootPartialViewTreeController(IPartialViewTreeService partialViewTreeService) - : this(partialViewTreeService, StaticServiceProvider.Instance.GetRequiredService()) - => _partialViewTreeService = partialViewTreeService; - [ActivatorUtilitiesConstructor] - [Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")] - public RootPartialViewTreeController(IPartialViewTreeService partialViewTreeService, FileSystems fileSystems) - : base(partialViewTreeService, fileSystems) => - _partialViewTreeService = partialViewTreeService; + public RootPartialViewTreeController(IPartialViewTreeService partialViewTreeService) + : base(partialViewTreeService) + { + } - [Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")] + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] + public RootPartialViewTreeController(IPartialViewTreeService partialViewTreeService, FileSystems fileSystems) + : base(partialViewTreeService, fileSystems) + { + } + + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] public RootPartialViewTreeController(FileSystems fileSystems) - : this(StaticServiceProvider.Instance.GetRequiredService(), fileSystems) + : base(fileSystems) { } diff --git a/src/Umbraco.Cms.Api.Management/Controllers/PartialView/Tree/SiblingsPartialViewTreeController.cs b/src/Umbraco.Cms.Api.Management/Controllers/PartialView/Tree/SiblingsPartialViewTreeController.cs index af1e3171a6..8b3354d0f6 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/PartialView/Tree/SiblingsPartialViewTreeController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/PartialView/Tree/SiblingsPartialViewTreeController.cs @@ -1,32 +1,31 @@ -using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; using Umbraco.Cms.Api.Common.ViewModels.Pagination; using Umbraco.Cms.Api.Management.Services.FileSystem; using Umbraco.Cms.Api.Management.ViewModels.Tree; -using Umbraco.Cms.Core.DependencyInjection; using Umbraco.Cms.Core.IO; namespace Umbraco.Cms.Api.Management.Controllers.PartialView.Tree; public class SiblingsPartialViewTreeController : PartialViewTreeControllerBase { - private readonly IPartialViewTreeService _partialViewTreeService; - // TODO Remove the static service provider, and replace with base when the other constructors are obsoleted. - public SiblingsPartialViewTreeController(IPartialViewTreeService partialViewTreeService) - : this(partialViewTreeService, StaticServiceProvider.Instance.GetRequiredService()) - => _partialViewTreeService = partialViewTreeService; - [ActivatorUtilitiesConstructor] - [Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")] - public SiblingsPartialViewTreeController(IPartialViewTreeService partialViewTreeService, FileSystems fileSystems) - : base(partialViewTreeService, fileSystems) => - _partialViewTreeService = partialViewTreeService; + public SiblingsPartialViewTreeController(IPartialViewTreeService partialViewTreeService) + : base(partialViewTreeService) + { + } - [Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")] + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] + public SiblingsPartialViewTreeController(IPartialViewTreeService partialViewTreeService, FileSystems fileSystems) + : base(partialViewTreeService, fileSystems) + { + } + + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] public SiblingsPartialViewTreeController(FileSystems fileSystems) - : this(StaticServiceProvider.Instance.GetRequiredService(), fileSystems) + : base(fileSystems) { } diff --git a/src/Umbraco.Cms.Api.Management/Controllers/Script/Tree/AncestorsScriptTreeController.cs b/src/Umbraco.Cms.Api.Management/Controllers/Script/Tree/AncestorsScriptTreeController.cs index ed5acbc0c3..0aef76c5b7 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/Script/Tree/AncestorsScriptTreeController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/Script/Tree/AncestorsScriptTreeController.cs @@ -1,10 +1,9 @@ -using Asp.Versioning; +using Asp.Versioning; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; using Umbraco.Cms.Api.Management.Services.FileSystem; using Umbraco.Cms.Api.Management.ViewModels.Tree; -using Umbraco.Cms.Core.DependencyInjection; using Umbraco.Cms.Core.IO; namespace Umbraco.Cms.Api.Management.Controllers.Script.Tree; @@ -12,22 +11,22 @@ namespace Umbraco.Cms.Api.Management.Controllers.Script.Tree; [ApiVersion("1.0")] public class AncestorsScriptTreeController : ScriptTreeControllerBase { - private readonly IScriptTreeService _scriptTreeService; - // TODO Remove the static service provider, and replace with base when the other constructors are obsoleted. - public AncestorsScriptTreeController(IScriptTreeService scriptTreeService) - : this(scriptTreeService, StaticServiceProvider.Instance.GetRequiredService()) - => _scriptTreeService = scriptTreeService; - [ActivatorUtilitiesConstructor] - [Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")] - public AncestorsScriptTreeController(IScriptTreeService scriptTreeService, FileSystems fileSystems) - : base(scriptTreeService, fileSystems) => - _scriptTreeService = scriptTreeService; + public AncestorsScriptTreeController(IScriptTreeService scriptTreeService) + : base(scriptTreeService) + { + } - [Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")] + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] + public AncestorsScriptTreeController(IScriptTreeService scriptTreeService, FileSystems fileSystems) + : base(scriptTreeService, fileSystems) + { + } + + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] public AncestorsScriptTreeController(FileSystems fileSystems) - : this(StaticServiceProvider.Instance.GetRequiredService(), fileSystems) + : base(fileSystems) { } diff --git a/src/Umbraco.Cms.Api.Management/Controllers/Script/Tree/ChildrenScriptTreeController.cs b/src/Umbraco.Cms.Api.Management/Controllers/Script/Tree/ChildrenScriptTreeController.cs index ba40037841..8313b62941 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/Script/Tree/ChildrenScriptTreeController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/Script/Tree/ChildrenScriptTreeController.cs @@ -1,34 +1,33 @@ -using Asp.Versioning; +using Asp.Versioning; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; -using Umbraco.Cms.Core.IO; using Umbraco.Cms.Api.Common.ViewModels.Pagination; using Umbraco.Cms.Api.Management.Services.FileSystem; using Umbraco.Cms.Api.Management.ViewModels.Tree; -using Umbraco.Cms.Core.DependencyInjection; +using Umbraco.Cms.Core.IO; namespace Umbraco.Cms.Api.Management.Controllers.Script.Tree; [ApiVersion("1.0")] public class ChildrenScriptTreeController : ScriptTreeControllerBase { - private readonly IScriptTreeService _scriptTreeService; - // TODO Remove the static service provider, and replace with base when the other constructors are obsoleted. - public ChildrenScriptTreeController(IScriptTreeService scriptTreeService) - : this(scriptTreeService, StaticServiceProvider.Instance.GetRequiredService()) - => _scriptTreeService = scriptTreeService; - [ActivatorUtilitiesConstructor] - [Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")] - public ChildrenScriptTreeController(IScriptTreeService scriptTreeService, FileSystems fileSystems) - : base(scriptTreeService, fileSystems) => - _scriptTreeService = scriptTreeService; + public ChildrenScriptTreeController(IScriptTreeService scriptTreeService) + : base(scriptTreeService) + { + } - [Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")] + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] + public ChildrenScriptTreeController(IScriptTreeService scriptTreeService, FileSystems fileSystems) + : base(scriptTreeService, fileSystems) + { + } + + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] public ChildrenScriptTreeController(FileSystems fileSystems) - : this(StaticServiceProvider.Instance.GetRequiredService(), fileSystems) + : base(fileSystems) { } diff --git a/src/Umbraco.Cms.Api.Management/Controllers/Script/Tree/RootScriptTreeController.cs b/src/Umbraco.Cms.Api.Management/Controllers/Script/Tree/RootScriptTreeController.cs index f29d3bdb44..dcb5e2479c 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/Script/Tree/RootScriptTreeController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/Script/Tree/RootScriptTreeController.cs @@ -1,34 +1,33 @@ -using Asp.Versioning; +using Asp.Versioning; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; -using Umbraco.Cms.Core.IO; using Umbraco.Cms.Api.Common.ViewModels.Pagination; using Umbraco.Cms.Api.Management.Services.FileSystem; using Umbraco.Cms.Api.Management.ViewModels.Tree; -using Umbraco.Cms.Core.DependencyInjection; +using Umbraco.Cms.Core.IO; namespace Umbraco.Cms.Api.Management.Controllers.Script.Tree; [ApiVersion("1.0")] public class RootScriptTreeController : ScriptTreeControllerBase { - private readonly IScriptTreeService _scriptTreeService; - // TODO Remove the static service provider, and replace with base when the other constructors are obsoleted. - public RootScriptTreeController(IScriptTreeService scriptTreeService) - : this(scriptTreeService, StaticServiceProvider.Instance.GetRequiredService()) - => _scriptTreeService = scriptTreeService; - [ActivatorUtilitiesConstructor] - [Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")] - public RootScriptTreeController(IScriptTreeService scriptTreeService, FileSystems fileSystems) - : base(scriptTreeService, fileSystems) => - _scriptTreeService = scriptTreeService; + public RootScriptTreeController(IScriptTreeService scriptTreeService) + : base(scriptTreeService) + { + } - [Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")] + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] + public RootScriptTreeController(IScriptTreeService scriptTreeService, FileSystems fileSystems) + : base(scriptTreeService, fileSystems) + { + } + + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] public RootScriptTreeController(FileSystems fileSystems) - : this(StaticServiceProvider.Instance.GetRequiredService(), fileSystems) + : base(fileSystems) { } diff --git a/src/Umbraco.Cms.Api.Management/Controllers/Script/Tree/ScriptTreeControllerBase.cs b/src/Umbraco.Cms.Api.Management/Controllers/Script/Tree/ScriptTreeControllerBase.cs index d79740d845..f803db096f 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/Script/Tree/ScriptTreeControllerBase.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/Script/Tree/ScriptTreeControllerBase.cs @@ -1,11 +1,9 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.DependencyInjection; using Umbraco.Cms.Api.Management.Controllers.Tree; using Umbraco.Cms.Api.Management.Routing; using Umbraco.Cms.Api.Management.Services.FileSystem; using Umbraco.Cms.Core; -using Umbraco.Cms.Core.DependencyInjection; using Umbraco.Cms.Core.IO; using Umbraco.Cms.Web.Common.Authorization; @@ -16,30 +14,28 @@ namespace Umbraco.Cms.Api.Management.Controllers.Script.Tree; [Authorize(Policy = AuthorizationPolicies.TreeAccessScripts)] public class ScriptTreeControllerBase : FileSystemTreeControllerBase { - private readonly IScriptTreeService _scriptTreeService; - // TODO Remove the static service provider, and replace with base when the other constructors are obsoleted. public ScriptTreeControllerBase(IScriptTreeService scriptTreeService) - : this(scriptTreeService, StaticServiceProvider.Instance.GetRequiredService()) => - _scriptTreeService = scriptTreeService; + : base(scriptTreeService) + { + FileSystem = null!; + } - // FileSystem is required therefore, we can't remove it without some wizadry. When obsoletion is due, remove this. - [ActivatorUtilitiesConstructor] - [Obsolete("Scheduled for removal in Umbraco 18.")] + // FileSystem is required therefore, we can't remove it without some wizardry. When obsoletion is due, remove this. + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] public ScriptTreeControllerBase(IScriptTreeService scriptTreeService, FileSystems fileSystems) : base(scriptTreeService) { - _scriptTreeService = scriptTreeService; FileSystem = fileSystems.ScriptsFileSystem ?? throw new ArgumentException("Missing scripts file system", nameof(fileSystems)); } - [Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 18.")] + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] public ScriptTreeControllerBase(FileSystems fileSystems) - : this(StaticServiceProvider.Instance.GetRequiredService()) + : base() => FileSystem = fileSystems.ScriptsFileSystem ?? throw new ArgumentException("Missing scripts file system", nameof(fileSystems)); - [Obsolete("Included in the service class. Scheduled to be removed in Umbraco 18.")] + [Obsolete("Included in the service class. Scheduled to be removed in Umbraco 19.")] protected override IFileSystem FileSystem { get; } } diff --git a/src/Umbraco.Cms.Api.Management/Controllers/Script/Tree/SiblingsScriptTreeController.cs b/src/Umbraco.Cms.Api.Management/Controllers/Script/Tree/SiblingsScriptTreeController.cs index deec60cacb..fa53cfa774 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/Script/Tree/SiblingsScriptTreeController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/Script/Tree/SiblingsScriptTreeController.cs @@ -1,32 +1,31 @@ -using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; using Umbraco.Cms.Api.Common.ViewModels.Pagination; using Umbraco.Cms.Api.Management.Services.FileSystem; using Umbraco.Cms.Api.Management.ViewModels.Tree; -using Umbraco.Cms.Core.DependencyInjection; using Umbraco.Cms.Core.IO; namespace Umbraco.Cms.Api.Management.Controllers.Script.Tree; public class SiblingsScriptTreeController : ScriptTreeControllerBase { - private readonly IScriptTreeService _scriptTreeService; - // TODO Remove the static service provider, and replace with base when the other constructors are obsoleted. - public SiblingsScriptTreeController(IScriptTreeService scriptTreeService) - : this(scriptTreeService, StaticServiceProvider.Instance.GetRequiredService()) - => _scriptTreeService = scriptTreeService; - [ActivatorUtilitiesConstructor] - [Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")] - public SiblingsScriptTreeController(IScriptTreeService scriptTreeService, FileSystems fileSystems) - : base(scriptTreeService, fileSystems) => - _scriptTreeService = scriptTreeService; + public SiblingsScriptTreeController(IScriptTreeService scriptTreeService) + : base(scriptTreeService) + { + } - [Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")] + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] + public SiblingsScriptTreeController(IScriptTreeService scriptTreeService, FileSystems fileSystems) + : base(scriptTreeService, fileSystems) + { + } + + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] public SiblingsScriptTreeController(FileSystems fileSystems) - : this(StaticServiceProvider.Instance.GetRequiredService(), fileSystems) + : base(fileSystems) { } diff --git a/src/Umbraco.Cms.Api.Management/Controllers/Stylesheet/Tree/AncestorsStylesheetTreeController.cs b/src/Umbraco.Cms.Api.Management/Controllers/Stylesheet/Tree/AncestorsStylesheetTreeController.cs index 3760808263..2663152f4c 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/Stylesheet/Tree/AncestorsStylesheetTreeController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/Stylesheet/Tree/AncestorsStylesheetTreeController.cs @@ -1,10 +1,9 @@ -using Asp.Versioning; +using Asp.Versioning; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; using Umbraco.Cms.Api.Management.Services.FileSystem; using Umbraco.Cms.Api.Management.ViewModels.Tree; -using Umbraco.Cms.Core.DependencyInjection; using Umbraco.Cms.Core.IO; namespace Umbraco.Cms.Api.Management.Controllers.Stylesheet.Tree; @@ -12,22 +11,22 @@ namespace Umbraco.Cms.Api.Management.Controllers.Stylesheet.Tree; [ApiVersion("1.0")] public class AncestorsStylesheetTreeController : StylesheetTreeControllerBase { - private readonly IStyleSheetTreeService _styleSheetTreeService; - // TODO Remove the static service provider, and replace with base when the other constructors are obsoleted. - public AncestorsStylesheetTreeController(IStyleSheetTreeService styleSheetTreeService) - : this(styleSheetTreeService, StaticServiceProvider.Instance.GetRequiredService()) - => _styleSheetTreeService = styleSheetTreeService; - [ActivatorUtilitiesConstructor] - [Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")] - public AncestorsStylesheetTreeController(IStyleSheetTreeService styleSheetTreeService, FileSystems fileSystems) - : base(styleSheetTreeService, fileSystems) => - _styleSheetTreeService = styleSheetTreeService; + public AncestorsStylesheetTreeController(IStyleSheetTreeService styleSheetTreeService) + : base(styleSheetTreeService) + { + } - [Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")] + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] + public AncestorsStylesheetTreeController(IStyleSheetTreeService styleSheetTreeService, FileSystems fileSystems) + : base(styleSheetTreeService, fileSystems) + { + } + + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] public AncestorsStylesheetTreeController(FileSystems fileSystems) - : this(StaticServiceProvider.Instance.GetRequiredService(), fileSystems) + : base(fileSystems) { } diff --git a/src/Umbraco.Cms.Api.Management/Controllers/Stylesheet/Tree/ChildrenStylesheetTreeController.cs b/src/Umbraco.Cms.Api.Management/Controllers/Stylesheet/Tree/ChildrenStylesheetTreeController.cs index 41484bce50..bf016b54e3 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/Stylesheet/Tree/ChildrenStylesheetTreeController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/Stylesheet/Tree/ChildrenStylesheetTreeController.cs @@ -1,36 +1,36 @@ -using Asp.Versioning; +using Asp.Versioning; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; -using Umbraco.Cms.Core.IO; using Umbraco.Cms.Api.Common.ViewModels.Pagination; using Umbraco.Cms.Api.Management.Services.FileSystem; using Umbraco.Cms.Api.Management.ViewModels.Tree; -using Umbraco.Cms.Core.DependencyInjection; +using Umbraco.Cms.Core.IO; namespace Umbraco.Cms.Api.Management.Controllers.Stylesheet.Tree; [ApiVersion("1.0")] public class ChildrenStylesheetTreeController : StylesheetTreeControllerBase { - private readonly IStyleSheetTreeService _styleSheetTreeService; - // TODO Remove the static service provider, and replace with base when the other constructors are obsoleted. - public ChildrenStylesheetTreeController(IStyleSheetTreeService styleSheetTreeService) - : this(styleSheetTreeService, StaticServiceProvider.Instance.GetRequiredService()) - => _styleSheetTreeService = styleSheetTreeService; - [ActivatorUtilitiesConstructor] - [Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")] - public ChildrenStylesheetTreeController(IStyleSheetTreeService styleSheetTreeService, FileSystems fileSystems) - : base(styleSheetTreeService, fileSystems) => - _styleSheetTreeService = styleSheetTreeService; - - [Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")] - public ChildrenStylesheetTreeController(FileSystems fileSystems) - : this(StaticServiceProvider.Instance.GetRequiredService(), fileSystems) + public ChildrenStylesheetTreeController(IStyleSheetTreeService styleSheetTreeService) + : base(styleSheetTreeService) { } + + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] + public ChildrenStylesheetTreeController(IStyleSheetTreeService styleSheetTreeService, FileSystems fileSystems) + : base(styleSheetTreeService, fileSystems) + { + } + + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] + public ChildrenStylesheetTreeController(FileSystems fileSystems) + : base(fileSystems) + { + } + [HttpGet("children")] [MapToApiVersion("1.0")] [ProducesResponseType(typeof(PagedViewModel), StatusCodes.Status200OK)] diff --git a/src/Umbraco.Cms.Api.Management/Controllers/Stylesheet/Tree/RootStylesheetTreeController.cs b/src/Umbraco.Cms.Api.Management/Controllers/Stylesheet/Tree/RootStylesheetTreeController.cs index 417c636a37..c47828d092 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/Stylesheet/Tree/RootStylesheetTreeController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/Stylesheet/Tree/RootStylesheetTreeController.cs @@ -1,34 +1,33 @@ -using Asp.Versioning; +using Asp.Versioning; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; -using Umbraco.Cms.Core.IO; using Umbraco.Cms.Api.Common.ViewModels.Pagination; using Umbraco.Cms.Api.Management.Services.FileSystem; using Umbraco.Cms.Api.Management.ViewModels.Tree; -using Umbraco.Cms.Core.DependencyInjection; +using Umbraco.Cms.Core.IO; namespace Umbraco.Cms.Api.Management.Controllers.Stylesheet.Tree; [ApiVersion("1.0")] public class RootStylesheetTreeController : StylesheetTreeControllerBase { - private readonly IStyleSheetTreeService _styleSheetTreeService; - // TODO Remove the static service provider, and replace with base when the other constructors are obsoleted. - public RootStylesheetTreeController(IStyleSheetTreeService styleSheetTreeService) - : this(styleSheetTreeService, StaticServiceProvider.Instance.GetRequiredService()) - => _styleSheetTreeService = styleSheetTreeService; - [ActivatorUtilitiesConstructor] - [Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")] - public RootStylesheetTreeController(IStyleSheetTreeService styleSheetTreeService, FileSystems fileSystems) - : base(styleSheetTreeService, fileSystems) => - _styleSheetTreeService = styleSheetTreeService; + public RootStylesheetTreeController(IStyleSheetTreeService styleSheetTreeService) + : base(styleSheetTreeService) + { + } - [Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")] + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] + public RootStylesheetTreeController(IStyleSheetTreeService styleSheetTreeService, FileSystems fileSystems) + : base(styleSheetTreeService, fileSystems) + { + } + + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] public RootStylesheetTreeController(FileSystems fileSystems) - : this(StaticServiceProvider.Instance.GetRequiredService(), fileSystems) + : base(fileSystems) { } diff --git a/src/Umbraco.Cms.Api.Management/Controllers/Stylesheet/Tree/SiblingsStylesheetTreeController.cs b/src/Umbraco.Cms.Api.Management/Controllers/Stylesheet/Tree/SiblingsStylesheetTreeController.cs index 0f2b03b704..b56afe70b7 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/Stylesheet/Tree/SiblingsStylesheetTreeController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/Stylesheet/Tree/SiblingsStylesheetTreeController.cs @@ -1,32 +1,31 @@ -using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; using Umbraco.Cms.Api.Common.ViewModels.Pagination; using Umbraco.Cms.Api.Management.Services.FileSystem; using Umbraco.Cms.Api.Management.ViewModels.Tree; -using Umbraco.Cms.Core.DependencyInjection; using Umbraco.Cms.Core.IO; namespace Umbraco.Cms.Api.Management.Controllers.Stylesheet.Tree; public class SiblingsStylesheetTreeController : StylesheetTreeControllerBase { - private readonly IStyleSheetTreeService _styleSheetTreeService; - // TODO Remove the static service provider, and replace with base when the other constructors are obsoleted. - public SiblingsStylesheetTreeController(IStyleSheetTreeService styleSheetTreeService) - : this(styleSheetTreeService, StaticServiceProvider.Instance.GetRequiredService()) - => _styleSheetTreeService = styleSheetTreeService; - [ActivatorUtilitiesConstructor] - [Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")] - public SiblingsStylesheetTreeController(IStyleSheetTreeService styleSheetTreeService, FileSystems fileSystems) - : base(styleSheetTreeService, fileSystems) => - _styleSheetTreeService = styleSheetTreeService; + public SiblingsStylesheetTreeController(IStyleSheetTreeService styleSheetTreeService) + : base(styleSheetTreeService) + { + } - [Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 19")] + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] + public SiblingsStylesheetTreeController(IStyleSheetTreeService styleSheetTreeService, FileSystems fileSystems) + : base(styleSheetTreeService, fileSystems) + { + } + + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] public SiblingsStylesheetTreeController(FileSystems fileSystems) - : this(StaticServiceProvider.Instance.GetRequiredService(), fileSystems) + : base(fileSystems) { } diff --git a/src/Umbraco.Cms.Api.Management/Controllers/Stylesheet/Tree/StylesheetTreeControllerBase.cs b/src/Umbraco.Cms.Api.Management/Controllers/Stylesheet/Tree/StylesheetTreeControllerBase.cs index 501293f11f..07382a1453 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/Stylesheet/Tree/StylesheetTreeControllerBase.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/Stylesheet/Tree/StylesheetTreeControllerBase.cs @@ -1,11 +1,9 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.DependencyInjection; using Umbraco.Cms.Api.Management.Controllers.Tree; using Umbraco.Cms.Api.Management.Routing; using Umbraco.Cms.Api.Management.Services.FileSystem; using Umbraco.Cms.Core; -using Umbraco.Cms.Core.DependencyInjection; using Umbraco.Cms.Core.IO; using Umbraco.Cms.Web.Common.Authorization; @@ -16,30 +14,28 @@ namespace Umbraco.Cms.Api.Management.Controllers.Stylesheet.Tree; [Authorize(Policy = AuthorizationPolicies.TreeAccessStylesheets)] public class StylesheetTreeControllerBase : FileSystemTreeControllerBase { - private readonly IStyleSheetTreeService _styleSheetTreeService; - // TODO Remove the static service provider, and replace with base when the other constructors are obsoleted. public StylesheetTreeControllerBase(IStyleSheetTreeService styleSheetTreeService) - : this(styleSheetTreeService, StaticServiceProvider.Instance.GetRequiredService()) => - _styleSheetTreeService = styleSheetTreeService; + : base(styleSheetTreeService) + { + FileSystem = null!; + } // FileSystem is required therefore, we can't remove it without some wizadry. When obsoletion is due, remove this. - [ActivatorUtilitiesConstructor] - [Obsolete("Scheduled for removal in Umbraco 18.")] + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] public StylesheetTreeControllerBase(IStyleSheetTreeService styleSheetTreeService, FileSystems fileSystems) : base(styleSheetTreeService) { - _styleSheetTreeService = styleSheetTreeService; FileSystem = fileSystems.ScriptsFileSystem ?? throw new ArgumentException("Missing scripts file system", nameof(fileSystems)); } - [Obsolete("Please use the other constructor. Scheduled to be removed in Umbraco 18.")] + [Obsolete("Please use the constructor taking all parameters. Scheduled to be removed in Umbraco 19.")] public StylesheetTreeControllerBase(FileSystems fileSystems) - : this(StaticServiceProvider.Instance.GetRequiredService()) + : base() => FileSystem = fileSystems.ScriptsFileSystem ?? throw new ArgumentException("Missing scripts file system", nameof(fileSystems)); - [Obsolete("Included in the service class. Scheduled to be removed in Umbraco 18.")] + [Obsolete("Included in the service class. Scheduled to be removed in Umbraco 19.")] protected override IFileSystem FileSystem { get; } } diff --git a/src/Umbraco.Cms.Api.Management/Controllers/Tree/FileSystemTreeControllerBase.cs b/src/Umbraco.Cms.Api.Management/Controllers/Tree/FileSystemTreeControllerBase.cs index 68d1414788..fa3b2027b3 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/Tree/FileSystemTreeControllerBase.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/Tree/FileSystemTreeControllerBase.cs @@ -5,7 +5,6 @@ using Umbraco.Cms.Api.Management.Extensions; using Umbraco.Cms.Api.Management.Services.FileSystem; using Umbraco.Cms.Api.Management.ViewModels.FileSystem; using Umbraco.Cms.Api.Management.ViewModels.Tree; -using Umbraco.Cms.Core.DependencyInjection; using Umbraco.Cms.Core.IO; using Umbraco.Extensions; @@ -13,23 +12,30 @@ namespace Umbraco.Cms.Api.Management.Controllers.Tree; public abstract class FileSystemTreeControllerBase : ManagementApiControllerBase { - private readonly IFileSystemTreeService _fileSystemTreeService; + private readonly IFileSystemTreeService _fileSystemTreeService = null!; - [Obsolete("Has been moved to the individual services. Scheduled to be removed in Umbraco 18.")] + /// + /// Indicates whether to use the IFileSystemTreeService or the legacy implementation. + /// + /// + /// This is retained to ensure that any controllers outside of the CMS that use this base class with the obsolete constructor + /// continue to function until they can be updated to use the new service. + /// To be removed along with the constructor taking no parameters in Umbraco 19. + /// + private readonly bool _useFileSystemTreeService = true; + + [Obsolete("Has been moved to the individual services. Scheduled to be removed in Umbraco 19.")] protected abstract IFileSystem FileSystem { get; } [ActivatorUtilitiesConstructor] protected FileSystemTreeControllerBase(IFileSystemTreeService fileSystemTreeService) => _fileSystemTreeService = fileSystemTreeService; - [Obsolete("Use the other constructor. Scheduled for removal in Umbraco 18.")] - protected FileSystemTreeControllerBase() - : this(StaticServiceProvider.Instance.GetRequiredService()) - { - } + [Obsolete("Please use the constructor taking all parameters. Scheduled for removal in Umbraco 19.")] + protected FileSystemTreeControllerBase() => _useFileSystemTreeService = false; protected Task>> GetRoot(int skip, int take) { - FileSystemTreeItemPresentationModel[] viewModels = _fileSystemTreeService.GetPathViewModels(string.Empty, skip, take, out var totalItems); + FileSystemTreeItemPresentationModel[] viewModels = GetPathViewModels(string.Empty, skip, take, out var totalItems); PagedViewModel result = PagedViewModel(viewModels, totalItems); return Task.FromResult>>(Ok(result)); @@ -37,14 +43,14 @@ public abstract class FileSystemTreeControllerBase : ManagementApiControllerBase protected Task>> GetChildren(string path, int skip, int take) { - FileSystemTreeItemPresentationModel[] viewModels = _fileSystemTreeService.GetPathViewModels(path, skip, take, out var totalItems); + FileSystemTreeItemPresentationModel[] viewModels = GetPathViewModels(path, skip, take, out var totalItems); PagedViewModel result = PagedViewModel(viewModels, totalItems); return Task.FromResult>>(Ok(result)); } /// - /// Gets the sibling of the targeted item based on its path. + /// Gets the siblings of the targeted item based on its path. /// /// The path to the item. /// The amount of siblings you want to fetch from before the items position in the array. @@ -61,17 +67,19 @@ public abstract class FileSystemTreeControllerBase : ManagementApiControllerBase protected virtual Task>> GetAncestors(string path, bool includeSelf = true) { path = path.VirtualPathToSystemPath(); - FileSystemTreeItemPresentationModel[] models = _fileSystemTreeService.GetAncestorModels(path, includeSelf); + FileSystemTreeItemPresentationModel[] models = GetAncestorModels(path, includeSelf); return Task.FromResult>>(Ok(models)); } - private PagedViewModel PagedViewModel(IEnumerable viewModels, long totalItems) - => new() { Total = totalItems, Items = viewModels }; - - [Obsolete("Has been moved to FileSystemTreeServiceBase. Scheduled for removal in Umbraco 18.")] + [Obsolete("Has been moved to FileSystemTreeServiceBase. Scheduled for removal in Umbraco 19.")] protected virtual FileSystemTreeItemPresentationModel[] GetAncestorModels(string path, bool includeSelf) { + if (_useFileSystemTreeService) + { + return _fileSystemTreeService.GetAncestorModels(path, includeSelf); + } + var directories = path.Split(Path.DirectorySeparatorChar).Take(Range.EndAt(Index.FromEnd(1))).ToArray(); var result = directories .Select((directory, index) => MapViewModel(string.Join(Path.DirectorySeparatorChar, directories.Take(index + 1)), directory, true)) @@ -86,28 +94,59 @@ public abstract class FileSystemTreeControllerBase : ManagementApiControllerBase return result.ToArray(); } - [Obsolete("Has been moved to FileSystemTreeServiceBase. Scheduled for removal in Umbraco 18.")] + [Obsolete("Has been moved to FileSystemTreeServiceBase. Scheduled for removal in Umbraco 19.")] protected virtual string[] GetDirectories(string path) => FileSystem .GetDirectories(path) .OrderBy(directory => directory) .ToArray(); - [Obsolete("Has been moved to FileSystemTreeServiceBase. Scheduled for removal in Umbraco 18.")] + [Obsolete("Has been moved to FileSystemTreeServiceBase. Scheduled for removal in Umbraco 19.")] protected virtual string[] GetFiles(string path) => FileSystem .GetFiles(path) .OrderBy(file => file) .ToArray(); - [Obsolete("Has been moved to FileSystemTreeServiceBase. Scheduled for removal in Umbraco 18.")] + [Obsolete("Has been moved to FileSystemTreeServiceBase. Scheduled for removal in Umbraco 19.")] protected virtual bool DirectoryHasChildren(string path) => FileSystem.GetFiles(path).Any() || FileSystem.GetDirectories(path).Any(); - [Obsolete("Has been moved to FileSystemTreeServiceBase. Scheduled for removal in Umbraco 18.")] + [Obsolete("Has been moved to FileSystemTreeServiceBase. Scheduled for removal in Umbraco 19.")] private string GetFileSystemItemName(bool isFolder, string itemPath) => isFolder ? Path.GetFileName(itemPath) : FileSystem.GetFileName(itemPath); - [Obsolete("Has been moved to FileSystemTreeServiceBase. Scheduled for removal in Umbraco 18.")] + private FileSystemTreeItemPresentationModel[] GetPathViewModels(string path, int skip, int take, out long totalItems) + { + if (_useFileSystemTreeService) + { + return _fileSystemTreeService.GetPathViewModels(path, skip, take, out totalItems); + } + + path = path.VirtualPathToSystemPath(); + var allItems = GetDirectories(path) + .Select(directory => new { Path = directory, IsFolder = true }) + .Union(GetFiles(path).Select(file => new { Path = file, IsFolder = false })) + .ToArray(); + + totalItems = allItems.Length; + + FileSystemTreeItemPresentationModel ViewModel(string itemPath, bool isFolder) + => MapViewModel( + itemPath, + GetFileSystemItemName(isFolder, itemPath), + isFolder); + + return allItems + .Skip(skip) + .Take(take) + .Select(item => ViewModel(item.Path, item.IsFolder)) + .ToArray(); + } + + private PagedViewModel PagedViewModel(IEnumerable viewModels, long totalItems) + => new() { Total = totalItems, Items = viewModels }; + + [Obsolete("Has been moved to FileSystemTreeServiceBase. Scheduled for removal in Umbraco 19.")] private FileSystemTreeItemPresentationModel MapViewModel(string path, string name, bool isFolder) { var parentPath = Path.GetDirectoryName(path); From 8434c7d0cbf919532be72e0c86bfed5a3af66877 Mon Sep 17 00:00:00 2001 From: Engiber Lozada <89547469+engijlr@users.noreply.github.com> Date: Thu, 23 Oct 2025 15:49:14 +0200 Subject: [PATCH 4/7] Icon Picker: Fix empty selection allowed on mandatory fields and add validation. (#20536) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Not show the empty tile when filtering is active. * Added mandatory property to the icon picker. * Avoid deselecting the icon on second click when not showing the empty option. * Extends the form control mixin to the icon picker. * Used super.value. * Support mandatory from settings config. * Removed mandatoryConf. * remove requestUpdate --------- Co-authored-by: Niels Lyngsø --- .../icon-picker-modal.element.ts | 38 +++++++++++++------ .../icon-picker-modal.token.ts | 1 + .../property-editor-ui-icon-picker.element.ts | 37 +++++++++++++----- 3 files changed, 54 insertions(+), 22 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/icon-registry/icon-picker-modal/icon-picker-modal.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/icon-registry/icon-picker-modal/icon-picker-modal.element.ts index 0311318845..7227be73a0 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/icon-registry/icon-picker-modal/icon-picker-modal.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/icon-registry/icon-picker-modal/icon-picker-modal.element.ts @@ -30,6 +30,9 @@ export class UmbIconPickerModalElement extends UmbModalBaseElement !color.legacy); + @state() + private _isSearching = false; + constructor() { super(); this.consumeContext(UMB_ICON_REGISTRY_CONTEXT, (context) => { @@ -44,8 +47,10 @@ export class UmbIconPickerModalElement extends UmbModalBaseElement 0; this._iconsFiltered = this.#icons.filter((icon) => icon.name.toLowerCase().includes(value.toLowerCase())); } else { + this._isSearching = false; this._iconsFiltered = this.#icons; } } @@ -54,8 +59,12 @@ export class UmbIconPickerModalElement extends UmbModalBaseElement
- { - if (e.key === 'Enter' || e.key === ' ') this.#clearIcon(); - }}> - ${this.renderIcons()} { + if (e.key === 'Enter' || e.key === ' ') this.#clearIcon(); + }}> + + + ` + : nothing} + ${this.renderIcons()} (UmbLitElement, undefined) + implements UmbPropertyEditorUiElement +{ + @property({ type: Boolean }) + mandatory = false; + + protected override firstUpdated(): void { + this.addValidator( + 'valueMissing', + () => 'Icon is required', + () => this.mandatory && !this._icon, + ); + } + @property() - public set value(v: string) { - this._value = v ?? ''; - const parts = this._value.split(' '); + public override set value(v: string) { + const val = v ?? ''; + super.value = val; + + const parts = val.split(' '); if (parts.length === 2) { this._icon = parts[0]; this._color = parts[1].replace('color-', ''); } else { - this._icon = this._value; + this._icon = val; this._color = ''; } } - public get value() { - return this._value; + + public override get value() { + return (super.value as string) ?? ''; } - private _value = ''; @state() private _icon = ''; @@ -53,7 +70,7 @@ export class UmbPropertyEditorUIIconPickerElement extends UmbLitElement implemen icon: this._icon, color: this._color, }, - data: { placeholder: this._placeholderIcon }, + data: { placeholder: this._placeholderIcon, showEmptyOption: !this.mandatory }, }).catch(() => undefined); if (!data) return; From d9c201e3d17265591681814b7782d13630ce37b1 Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Fri, 24 Oct 2025 08:36:34 +0200 Subject: [PATCH 5/7] docs: Add backoffice preview URL to README files (#20623) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: Add backoffice preview URL to README files Added links to https://backofficepreview.umbraco.com/ in both the main repository README and the Umbraco.Web.UI.Client package README to make the live backoffice preview easily discoverable. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude * docs: fix link * Update .github/README.md Co-authored-by: Andy Butland --------- Co-authored-by: Claude Co-authored-by: Andy Butland --- .github/README.md | 8 ++++++++ src/Umbraco.Web.UI.Client/README.md | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/.github/README.md b/.github/README.md index 195d4f9a36..33cb2d41d6 100644 --- a/.github/README.md +++ b/.github/README.md @@ -38,6 +38,14 @@ Some important documentation links to get you started: - [Getting to know Umbraco](https://docs.umbraco.com/umbraco-cms/fundamentals/get-to-know-umbraco) - [Tutorials for creating a basic website and customizing the editing experience](https://docs.umbraco.com/umbraco-cms/tutorials/overview) +## Backoffice Preview + +Want to see the latest backoffice UI in action? Check out our live preview: + +**[backofficepreview.umbraco.com](https://backofficepreview.umbraco.com/)** + +This preview is automatically deployed from the main branch and showcases the latest backoffice features and improvements. It runs from mock data and persistent edits are not supported. + ## Get help If you need a bit of feedback while building your Umbraco projects, we are [chatty on Discord](https://discord.umbraco.com). Our Discord server serves as a social space for all Umbracians. If you have any questions or need some help with a problem, head over to our [dedicated forum](https://forum.umbraco.com/) where the Umbraco Community will be happy to help. diff --git a/src/Umbraco.Web.UI.Client/README.md b/src/Umbraco.Web.UI.Client/README.md index 1404fba49c..0bc565c8ed 100644 --- a/src/Umbraco.Web.UI.Client/README.md +++ b/src/Umbraco.Web.UI.Client/README.md @@ -2,6 +2,14 @@ This package contains the types for the Umbraco Backoffice. +## Preview + +A live preview of the latest backoffice build from the main branch is available at: + +**[backofficepreview.umbraco.com](https://backofficepreview.umbraco.com/)** + +This preview is automatically deployed via GitHub Actions whenever changes are pushed to main or version branches. + ## Installation ```bash From e8936827231000cc23466f0b8839d27190d4fda0 Mon Sep 17 00:00:00 2001 From: Jan Skovgaard <1932158+BatJan@users.noreply.github.com> Date: Thu, 23 Oct 2025 13:02:05 +0200 Subject: [PATCH 6/7] Don't call generateAlias on #onAliasChange() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently it's not possible to use characters like "_" and "-" in aliases due to this check - At least that is was @nul800sebastiaan told me 😇 Suggested fix for #20622 --- .../views/settings/property-workspace-view-settings.element.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/content/property-type/workspace/views/settings/property-workspace-view-settings.element.ts b/src/Umbraco.Web.UI.Client/src/packages/content/property-type/workspace/views/settings/property-workspace-view-settings.element.ts index b12707f699..7bef08e813 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/content/property-type/workspace/views/settings/property-workspace-view-settings.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/content/property-type/workspace/views/settings/property-workspace-view-settings.element.ts @@ -108,7 +108,7 @@ export class UmbPropertyTypeWorkspaceViewSettingsElement extends UmbLitElement i #onAliasChange() { // TODO: Why can I not get the correct value via event? Is it an issue in uui library too? - const alias = generateAlias(this._aliasInput.value.toString()); + const alias = this._aliasInput.value.toString(); this.updateValue({ alias }); } From f33eb3f678c24c0b0b34ea27bcf6b14923c721af Mon Sep 17 00:00:00 2001 From: Andy Butland Date: Mon, 27 Oct 2025 13:42:48 +0100 Subject: [PATCH 7/7] Media types: Handle null configured file extensions when populating allowed media types (closes #20620) (#20635) * Handle null configured file extensions when populating allowed media types. * Added clarifying comment. --- .../Services/ContentTypeEditing/MediaTypeEditingService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Core/Services/ContentTypeEditing/MediaTypeEditingService.cs b/src/Umbraco.Core/Services/ContentTypeEditing/MediaTypeEditingService.cs index 8a626215b4..4955eeec9c 100644 --- a/src/Umbraco.Core/Services/ContentTypeEditing/MediaTypeEditingService.cs +++ b/src/Umbraco.Core/Services/ContentTypeEditing/MediaTypeEditingService.cs @@ -175,7 +175,7 @@ internal sealed class MediaTypeEditingService : ContentTypeEditingServiceBase