diff --git a/src/Umbraco.Cms.Api.Management/Controllers/Member/Item/SearchMemberItemController.cs b/src/Umbraco.Cms.Api.Management/Controllers/Member/Item/SearchMemberItemController.cs index 077bdf5278..78917f49ce 100644 --- a/src/Umbraco.Cms.Api.Management/Controllers/Member/Item/SearchMemberItemController.cs +++ b/src/Umbraco.Cms.Api.Management/Controllers/Member/Item/SearchMemberItemController.cs @@ -24,15 +24,15 @@ public class SearchMemberItemController : MemberItemControllerBase [HttpGet("search")] [MapToApiVersion("1.0")] [ProducesResponseType(typeof(PagedModel), StatusCodes.Status200OK)] - public Task SearchWithAllowedTypes(CancellationToken cancellationToken, string query, int skip = 0, int take = 100, [FromQuery]IEnumerable? allowedMemberTypes = null) + public async Task SearchWithAllowedTypes(CancellationToken cancellationToken, string query, int skip = 0, int take = 100, [FromQuery]IEnumerable? allowedMemberTypes = null) { - PagedModel searchResult = _indexedEntitySearchService.Search(UmbracoObjectTypes.Member, query, null, allowedMemberTypes, skip, take); + PagedModel searchResult = await _indexedEntitySearchService.SearchAsync(UmbracoObjectTypes.Member, query, null, allowedMemberTypes, false, "*", skip, take); var result = new PagedModel { Items = searchResult.Items.OfType().Select(_memberPresentationFactory.CreateItemResponseModel), - Total = searchResult.Total + Total = searchResult.Total, }; - return Task.FromResult(Ok(result)); + return await Task.FromResult(Ok(result)); } } diff --git a/src/Umbraco.Core/Actions/ActionAssignDomain.cs b/src/Umbraco.Core/Actions/ActionAssignDomain.cs index c321a9292d..79b933fa22 100644 --- a/src/Umbraco.Core/Actions/ActionAssignDomain.cs +++ b/src/Umbraco.Core/Actions/ActionAssignDomain.cs @@ -20,12 +20,6 @@ public class ActionAssignDomain : IAction /// public string Alias => ActionAlias; - /// - public string Category => Constants.Conventions.PermissionCategories.AdministrationCategory; - - /// - public string Icon => "icon-home"; - /// public bool ShowInNotifier => false; diff --git a/src/Umbraco.Core/Actions/ActionBrowse.cs b/src/Umbraco.Core/Actions/ActionBrowse.cs index d18e9ef531..eb8d9daed9 100644 --- a/src/Umbraco.Core/Actions/ActionBrowse.cs +++ b/src/Umbraco.Core/Actions/ActionBrowse.cs @@ -33,11 +33,4 @@ public class ActionBrowse : IAction /// public bool CanBePermissionAssigned => true; - - /// - public string Icon => string.Empty; - - - /// - public string Category => Constants.Conventions.PermissionCategories.ContentCategory; } diff --git a/src/Umbraco.Core/Actions/ActionCopy.cs b/src/Umbraco.Core/Actions/ActionCopy.cs index bee8940fcb..989794a669 100644 --- a/src/Umbraco.Core/Actions/ActionCopy.cs +++ b/src/Umbraco.Core/Actions/ActionCopy.cs @@ -20,12 +20,6 @@ public class ActionCopy : IAction /// public string Alias => ActionAlias; - /// - public string Category => Constants.Conventions.PermissionCategories.StructureCategory; - - /// - public string Icon => "icon-documents"; - /// public bool ShowInNotifier => true; diff --git a/src/Umbraco.Core/Actions/ActionCreateBlueprintFromContent.cs b/src/Umbraco.Core/Actions/ActionCreateBlueprintFromContent.cs index 16a1f6af8d..009d307802 100644 --- a/src/Umbraco.Core/Actions/ActionCreateBlueprintFromContent.cs +++ b/src/Umbraco.Core/Actions/ActionCreateBlueprintFromContent.cs @@ -25,10 +25,4 @@ public class ActionCreateBlueprintFromContent : IAction /// public bool CanBePermissionAssigned => true; - - /// - public string Icon => Constants.Icons.Blueprint; - - /// - public string Category => Constants.Conventions.PermissionCategories.ContentCategory; } diff --git a/src/Umbraco.Core/Actions/ActionDelete.cs b/src/Umbraco.Core/Actions/ActionDelete.cs index 70d3da72eb..559c2f904b 100644 --- a/src/Umbraco.Core/Actions/ActionDelete.cs +++ b/src/Umbraco.Core/Actions/ActionDelete.cs @@ -20,12 +20,6 @@ public class ActionDelete : IAction /// public string Alias => ActionAlias; - /// - public string Category => Constants.Conventions.PermissionCategories.ContentCategory; - - /// - public string Icon => "icon-delete"; - /// public bool ShowInNotifier => true; diff --git a/src/Umbraco.Core/Actions/ActionDocumentPropertyRead.cs b/src/Umbraco.Core/Actions/ActionDocumentPropertyRead.cs index bf5515b97a..65fe4932cc 100644 --- a/src/Umbraco.Core/Actions/ActionDocumentPropertyRead.cs +++ b/src/Umbraco.Core/Actions/ActionDocumentPropertyRead.cs @@ -19,11 +19,5 @@ public class ActionDocumentPropertyRead : IAction /// public bool CanBePermissionAssigned => true; - - /// - public string Icon => string.Empty; - - /// - public string Category => Constants.Conventions.PermissionCategories.OtherCategory; } diff --git a/src/Umbraco.Core/Actions/ActionDocumentPropertyWrite.cs b/src/Umbraco.Core/Actions/ActionDocumentPropertyWrite.cs index dec8ad0e32..8effd527ae 100644 --- a/src/Umbraco.Core/Actions/ActionDocumentPropertyWrite.cs +++ b/src/Umbraco.Core/Actions/ActionDocumentPropertyWrite.cs @@ -19,11 +19,5 @@ public class ActionDocumentPropertyWrite : IAction /// public bool CanBePermissionAssigned => true; - - /// - public string Icon => string.Empty; - - /// - public string Category => Constants.Conventions.PermissionCategories.OtherCategory; } diff --git a/src/Umbraco.Core/Actions/ActionMove.cs b/src/Umbraco.Core/Actions/ActionMove.cs index 9bb850447b..5282691418 100644 --- a/src/Umbraco.Core/Actions/ActionMove.cs +++ b/src/Umbraco.Core/Actions/ActionMove.cs @@ -20,12 +20,6 @@ public class ActionMove : IAction /// public string Alias => ActionAlias; - /// - public string Category => Constants.Conventions.PermissionCategories.StructureCategory; - - /// - public string Icon => "icon-enter"; - /// public bool ShowInNotifier => true; diff --git a/src/Umbraco.Core/Actions/ActionNew.cs b/src/Umbraco.Core/Actions/ActionNew.cs index fc3efeeba1..aac3255c5f 100644 --- a/src/Umbraco.Core/Actions/ActionNew.cs +++ b/src/Umbraco.Core/Actions/ActionNew.cs @@ -20,15 +20,9 @@ public class ActionNew : IAction /// public string Alias => ActionAlias; - /// - public string Icon => "icon-add"; - /// public bool ShowInNotifier => true; /// public bool CanBePermissionAssigned => true; - - /// - public string Category => Constants.Conventions.PermissionCategories.ContentCategory; } diff --git a/src/Umbraco.Core/Actions/ActionNotify.cs b/src/Umbraco.Core/Actions/ActionNotify.cs index 4d21f66406..372332d99a 100644 --- a/src/Umbraco.Core/Actions/ActionNotify.cs +++ b/src/Umbraco.Core/Actions/ActionNotify.cs @@ -25,10 +25,4 @@ public class ActionNotify : IAction /// public bool CanBePermissionAssigned => true; - - /// - public string Icon => "icon-megaphone"; - - /// - public string Category => Constants.Conventions.PermissionCategories.ContentCategory; } diff --git a/src/Umbraco.Core/Actions/ActionProtect.cs b/src/Umbraco.Core/Actions/ActionProtect.cs index 8ba85bcdd8..087712a3d7 100644 --- a/src/Umbraco.Core/Actions/ActionProtect.cs +++ b/src/Umbraco.Core/Actions/ActionProtect.cs @@ -20,12 +20,6 @@ public class ActionProtect : IAction /// public string Alias => ActionAlias; - /// - public string Category => Constants.Conventions.PermissionCategories.AdministrationCategory; - - /// - public string Icon => "icon-lock"; - /// public bool ShowInNotifier => true; diff --git a/src/Umbraco.Core/Actions/ActionPublish.cs b/src/Umbraco.Core/Actions/ActionPublish.cs index c3098a17e6..4c3723cc7c 100644 --- a/src/Umbraco.Core/Actions/ActionPublish.cs +++ b/src/Umbraco.Core/Actions/ActionPublish.cs @@ -20,12 +20,6 @@ public class ActionPublish : IAction /// public string Alias => ActionAlias; - /// - public string Category => Constants.Conventions.PermissionCategories.ContentCategory; - - /// - public string Icon => string.Empty; - /// public bool ShowInNotifier => true; diff --git a/src/Umbraco.Core/Actions/ActionRestore.cs b/src/Umbraco.Core/Actions/ActionRestore.cs index 646134aaac..f243f39001 100644 --- a/src/Umbraco.Core/Actions/ActionRestore.cs +++ b/src/Umbraco.Core/Actions/ActionRestore.cs @@ -20,12 +20,6 @@ public class ActionRestore : IAction /// public string Alias => ActionAlias; - /// - public string? Category => null; - - /// - public string Icon => "icon-undo"; - /// public bool ShowInNotifier => true; diff --git a/src/Umbraco.Core/Actions/ActionRights.cs b/src/Umbraco.Core/Actions/ActionRights.cs index af39ac2f9e..96f44c685d 100644 --- a/src/Umbraco.Core/Actions/ActionRights.cs +++ b/src/Umbraco.Core/Actions/ActionRights.cs @@ -20,12 +20,6 @@ public class ActionRights : IAction /// public string Alias => ActionAlias; - /// - public string Category => Constants.Conventions.PermissionCategories.ContentCategory; - - /// - public string Icon => "icon-vcard"; - /// public bool ShowInNotifier => true; diff --git a/src/Umbraco.Core/Actions/ActionRollback.cs b/src/Umbraco.Core/Actions/ActionRollback.cs index eea850cb35..fc6338a9e5 100644 --- a/src/Umbraco.Core/Actions/ActionRollback.cs +++ b/src/Umbraco.Core/Actions/ActionRollback.cs @@ -20,12 +20,6 @@ public class ActionRollback : IAction /// public string Alias => ActionAlias; - /// - public string Category => Constants.Conventions.PermissionCategories.AdministrationCategory; - - /// - public string Icon => "icon-undo"; - /// public bool ShowInNotifier => true; diff --git a/src/Umbraco.Core/Actions/ActionSort.cs b/src/Umbraco.Core/Actions/ActionSort.cs index 0060fa729b..48ff7e0b7e 100644 --- a/src/Umbraco.Core/Actions/ActionSort.cs +++ b/src/Umbraco.Core/Actions/ActionSort.cs @@ -20,12 +20,6 @@ public class ActionSort : IAction /// public string Alias => ActionAlias; - /// - public string Category => Constants.Conventions.PermissionCategories.StructureCategory; - - /// - public string Icon => "icon-navigation-vertical"; - /// public bool ShowInNotifier => true; diff --git a/src/Umbraco.Core/Actions/ActionUnpublish.cs b/src/Umbraco.Core/Actions/ActionUnpublish.cs index 30a5f27a2f..50956b39ef 100644 --- a/src/Umbraco.Core/Actions/ActionUnpublish.cs +++ b/src/Umbraco.Core/Actions/ActionUnpublish.cs @@ -20,12 +20,6 @@ public class ActionUnpublish : IAction /// public string Alias => ActionAlias; - /// - public string Category => Constants.Conventions.PermissionCategories.ContentCategory; - - /// - public string Icon => "icon-circle-dotted"; - /// public bool ShowInNotifier => false; diff --git a/src/Umbraco.Core/Actions/ActionUpdate.cs b/src/Umbraco.Core/Actions/ActionUpdate.cs index b694c378ba..abf44228fc 100644 --- a/src/Umbraco.Core/Actions/ActionUpdate.cs +++ b/src/Umbraco.Core/Actions/ActionUpdate.cs @@ -20,12 +20,6 @@ public class ActionUpdate : IAction /// public string Alias => ActionAlias; - /// - public string Category => Constants.Conventions.PermissionCategories.ContentCategory; - - /// - public string Icon => "icon-save"; - /// public bool ShowInNotifier => true; diff --git a/src/Umbraco.Core/Actions/IAction.cs b/src/Umbraco.Core/Actions/IAction.cs index 59a3e871d2..61572f015b 100644 --- a/src/Umbraco.Core/Actions/IAction.cs +++ b/src/Umbraco.Core/Actions/IAction.cs @@ -34,24 +34,9 @@ public interface IAction : IDiscoverable /// bool CanBePermissionAssigned { get; } - /// - /// Gets the icon to display for this action - /// - [Obsolete("No longer used. Scheduled for removal in V17.")] - string Icon { get; } - /// /// Gets the alias for this action (must be unique). /// This is all lower-case because of case sensitive filesystems, see issue: https://github.com/umbraco/Umbraco-CMS/issues/11670. /// string Alias { get; } - - /// - /// Gets the category used for this action - /// - /// - /// Used in the UI when assigning permissions - /// - [Obsolete("No longer used. Scheduled for removal in V17.")] - string? Category { get; } } diff --git a/src/Umbraco.Core/Constants-DataTypes.cs b/src/Umbraco.Core/Constants-DataTypes.cs index 5db4d71efc..4b934f65a2 100644 --- a/src/Umbraco.Core/Constants-DataTypes.cs +++ b/src/Umbraco.Core/Constants-DataTypes.cs @@ -104,12 +104,6 @@ public static partial class Constants /// public const string ListViewMedia = "3A0156C4-3B8C-4803-BDC1-6871FAA83FFF"; - /// - /// Guid for List View - Members as string - /// - [Obsolete("No longer used in Umbraco. Scheduled for removal in Umbraco 17.")] - public const string ListViewMembers = "AA2C52A0-CE87-4E65-A47C-7DF09358585D"; - /// /// Guid for Date Picker with time as string /// diff --git a/src/Umbraco.Core/DeliveryApi/ApiContentBuilder.cs b/src/Umbraco.Core/DeliveryApi/ApiContentBuilder.cs index f362344390..1fcdf24da2 100644 --- a/src/Umbraco.Core/DeliveryApi/ApiContentBuilder.cs +++ b/src/Umbraco.Core/DeliveryApi/ApiContentBuilder.cs @@ -7,19 +7,6 @@ namespace Umbraco.Cms.Core.DeliveryApi; public sealed class ApiContentBuilder : ApiContentBuilderBase, IApiContentBuilder { - [Obsolete("Please use the constructor that takes an IVariationContextAccessor instead. Scheduled for removal in V17.")] - public ApiContentBuilder( - IApiContentNameProvider apiContentNameProvider, - IApiContentRouteBuilder apiContentRouteBuilder, - IOutputExpansionStrategyAccessor outputExpansionStrategyAccessor) - : this( - apiContentNameProvider, - apiContentRouteBuilder, - outputExpansionStrategyAccessor, - StaticServiceProvider.Instance.CreateInstance()) - { - } - public ApiContentBuilder( IApiContentNameProvider apiContentNameProvider, IApiContentRouteBuilder apiContentRouteBuilder, diff --git a/src/Umbraco.Core/DeliveryApi/ApiContentResponseBuilder.cs b/src/Umbraco.Core/DeliveryApi/ApiContentResponseBuilder.cs index 17d6271cb5..9d37da11f0 100644 --- a/src/Umbraco.Core/DeliveryApi/ApiContentResponseBuilder.cs +++ b/src/Umbraco.Core/DeliveryApi/ApiContentResponseBuilder.cs @@ -1,4 +1,3 @@ -using Umbraco.Cms.Core.DependencyInjection; using Umbraco.Cms.Core.Models.DeliveryApi; using Umbraco.Cms.Core.Models.PublishedContent; using Umbraco.Extensions; @@ -7,19 +6,6 @@ namespace Umbraco.Cms.Core.DeliveryApi; public class ApiContentResponseBuilder : ApiContentBuilderBase, IApiContentResponseBuilder { - [Obsolete("Please use the constructor that takes an IVariationContextAccessor instead. Scheduled for removal in V17.")] - public ApiContentResponseBuilder( - IApiContentNameProvider apiContentNameProvider, - IApiContentRouteBuilder apiContentRouteBuilder, - IOutputExpansionStrategyAccessor outputExpansionStrategyAccessor) - : this( - apiContentNameProvider, - apiContentRouteBuilder, - outputExpansionStrategyAccessor, - StaticServiceProvider.Instance.CreateInstance()) - { - } - public ApiContentResponseBuilder( IApiContentNameProvider apiContentNameProvider, IApiContentRouteBuilder apiContentRouteBuilder, diff --git a/src/Umbraco.Core/DeliveryApi/ApiContentRouteBuilder.cs b/src/Umbraco.Core/DeliveryApi/ApiContentRouteBuilder.cs index 9c3aad1cfc..93481887f7 100644 --- a/src/Umbraco.Core/DeliveryApi/ApiContentRouteBuilder.cs +++ b/src/Umbraco.Core/DeliveryApi/ApiContentRouteBuilder.cs @@ -46,51 +46,6 @@ public sealed class ApiContentRouteBuilder : IApiContentRouteBuilder requestSettings.OnChange(settings => _requestSettings = settings); } - [Obsolete("Use the non-obsolete constructor, scheduled for removal in v17")] - public ApiContentRouteBuilder( - IApiContentPathProvider apiContentPathProvider, - IOptions globalSettings, - IVariationContextAccessor variationContextAccessor, - IRequestPreviewService requestPreviewService, - IOptionsMonitor requestSettings, - IPublishedContentCache contentCache, - IDocumentNavigationQueryService navigationQueryService, - IPublishStatusQueryService publishStatusQueryService) - : this( - apiContentPathProvider, - globalSettings, - variationContextAccessor, - requestPreviewService, - requestSettings, - contentCache, - navigationQueryService, - publishStatusQueryService, - StaticServiceProvider.Instance.GetRequiredService()) - { - } - - [Obsolete("Use the non-obsolete constructor, scheduled for removal in v17")] - public ApiContentRouteBuilder( - IApiContentPathProvider apiContentPathProvider, - IOptions globalSettings, - IVariationContextAccessor variationContextAccessor, - IRequestPreviewService requestPreviewService, - IOptionsMonitor requestSettings, - IPublishedContentCache contentCache, - IDocumentNavigationQueryService navigationQueryService) - : this( - apiContentPathProvider, - globalSettings, - variationContextAccessor, - requestPreviewService, - requestSettings, - contentCache, - navigationQueryService, - StaticServiceProvider.Instance.GetRequiredService(), - StaticServiceProvider.Instance.GetRequiredService()) - { - } - public IApiContentRoute? Build(IPublishedContent content, string? culture = null) { if (content.ItemType != PublishedItemType.Content) diff --git a/src/Umbraco.Core/DeliveryApi/ApiPublishedContentCache.cs b/src/Umbraco.Core/DeliveryApi/ApiPublishedContentCache.cs index 5e48fb01c0..3bf450a9ec 100644 --- a/src/Umbraco.Core/DeliveryApi/ApiPublishedContentCache.cs +++ b/src/Umbraco.Core/DeliveryApi/ApiPublishedContentCache.cs @@ -17,35 +17,6 @@ public sealed class ApiPublishedContentCache : IApiPublishedContentCache private readonly IVariationContextAccessor _variationContextAccessor; private DeliveryApiSettings _deliveryApiSettings; - [Obsolete("Use the non-obsolete constructor. Will be removed in V17.")] - public ApiPublishedContentCache( - IRequestPreviewService requestPreviewService, - IRequestCultureService requestCultureService, - IOptionsMonitor deliveryApiSettings, - IDocumentUrlService documentUrlService, - IPublishedContentCache publishedContentCache) - : this( - requestPreviewService, - deliveryApiSettings, - StaticServiceProvider.Instance.GetRequiredService(), - publishedContentCache, - StaticServiceProvider.Instance.GetRequiredService()) - { - } - - [Obsolete("Use the non-obsolete constructor. Will be removed in V17.")] - public ApiPublishedContentCache( - IRequestPreviewService requestPreviewService, - IRequestCultureService requestCultureService, - IOptionsMonitor deliveryApiSettings, - IDocumentUrlService documentUrlService, - IApiDocumentUrlService apiDocumentUrlService, - IPublishedContentCache publishedContentCache, - IVariationContextAccessor variationContextAccessor) - : this(requestPreviewService, deliveryApiSettings, apiDocumentUrlService, publishedContentCache, variationContextAccessor) - { - } - public ApiPublishedContentCache( IRequestPreviewService requestPreviewService, IOptionsMonitor deliveryApiSettings, diff --git a/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs index cb5020f5b9..5ad01c0d16 100644 --- a/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs +++ b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs @@ -336,7 +336,8 @@ namespace Umbraco.Cms.Core.DependencyInjection factory.GetRequiredService(), factory.GetRequiredService(), factory.GetRequiredService(), - factory.GetRequiredService())); + factory.GetRequiredService(), + factory.GetRequiredService())); Services.AddUnique(); Services.AddUnique(factory => factory.GetRequiredService()); Services.AddUnique(factory => new LocalizedTextService( diff --git a/src/Umbraco.Core/Events/AddUnroutableContentWarningsWhenPublishingNotificationHandler.cs b/src/Umbraco.Core/Events/AddUnroutableContentWarningsWhenPublishingNotificationHandler.cs index bb94a68d79..c50e767b7f 100644 --- a/src/Umbraco.Core/Events/AddUnroutableContentWarningsWhenPublishingNotificationHandler.cs +++ b/src/Umbraco.Core/Events/AddUnroutableContentWarningsWhenPublishingNotificationHandler.cs @@ -61,71 +61,6 @@ public class AddUnroutableContentWarningsWhenPublishingNotificationHandler : INo _contentSettings = contentSettings.Value; } - [Obsolete("Use the non-obsolete constructor. Scheduled for removal in V17.")] - public AddUnroutableContentWarningsWhenPublishingNotificationHandler( - IPublishedRouter publishedRouter, - IUmbracoContextAccessor umbracoContextAccessor, - ILanguageService languageService, - ILocalizedTextService localizedTextService, - IContentService contentService, - IVariationContextAccessor variationContextAccessor, - ILoggerFactory loggerFactory, - UriUtility uriUtility, - IPublishedUrlProvider publishedUrlProvider, - IPublishedContentCache publishedContentCache, - IDocumentNavigationQueryService navigationQueryService, - IPublishedContentStatusFilteringService publishedContentStatusFilteringService, - IEventMessagesFactory eventMessagesFactory, - IOptions contentSettings) - : this( - publishedRouter, - umbracoContextAccessor, - languageService, - localizedTextService, - contentService, - variationContextAccessor, - loggerFactory, - uriUtility, - publishedUrlProvider, - navigationQueryService, - publishedContentStatusFilteringService, - eventMessagesFactory, - contentSettings) - { - } - - [Obsolete("Use the non-obsolete constructor. Scheduled for removal in V17.")] - public AddUnroutableContentWarningsWhenPublishingNotificationHandler( - IPublishedRouter publishedRouter, - IUmbracoContextAccessor umbracoContextAccessor, - ILanguageService languageService, - ILocalizedTextService localizedTextService, - IContentService contentService, - IVariationContextAccessor variationContextAccessor, - ILoggerFactory loggerFactory, - UriUtility uriUtility, - IPublishedUrlProvider publishedUrlProvider, - IPublishedContentCache publishedContentCache, - IDocumentNavigationQueryService navigationQueryService, - IEventMessagesFactory eventMessagesFactory, - IOptions contentSettings) - : this( - publishedRouter, - umbracoContextAccessor, - languageService, - localizedTextService, - contentService, - variationContextAccessor, - loggerFactory, - uriUtility, - publishedUrlProvider, - navigationQueryService, - StaticServiceProvider.Instance.GetRequiredService(), - eventMessagesFactory, - contentSettings) - { - } - public async Task HandleAsync(ContentPublishedNotification notification, CancellationToken cancellationToken) { if (_contentSettings.ShowUnroutableContentWarnings is false) diff --git a/src/Umbraco.Core/HealthChecks/HealthCheck.cs b/src/Umbraco.Core/HealthChecks/HealthCheck.cs index 076f214a74..58136a862e 100644 --- a/src/Umbraco.Core/HealthChecks/HealthCheck.cs +++ b/src/Umbraco.Core/HealthChecks/HealthCheck.cs @@ -46,20 +46,8 @@ public abstract class HealthCheck : IDiscoverable /// If there are possible actions to take to rectify this check, this method must be overridden by a sub class /// in order to explicitly provide those actions. /// - [Obsolete("Use GetStatusAsync instead. Will be removed in v17")] - public virtual Task> GetStatus() => Task.FromResult(Enumerable.Empty()); - - /// - /// Get the status for this health check - /// - /// - /// - /// If there are possible actions to take to rectify this check, this method must be overridden by a sub class - /// in order to explicitly provide those actions. - /// -#pragma warning disable CS0618 // Type or member is obsolete - public virtual Task> GetStatusAsync() => GetStatus(); -#pragma warning restore CS0618 // Type or member is obsolete + public virtual Task> GetStatusAsync() => + Task.FromResult(Enumerable.Empty()); /// /// Executes the action and returns it's status diff --git a/src/Umbraco.Core/Models/TemplateQuery/QueryResultModel.cs b/src/Umbraco.Core/Models/TemplateQuery/QueryResultModel.cs deleted file mode 100644 index 4ab5f10c58..0000000000 --- a/src/Umbraco.Core/Models/TemplateQuery/QueryResultModel.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Umbraco.Cms.Core.Models.TemplateQuery; - -[Obsolete("No longer used. Scheduled for removal in V17.")] -public class QueryResultModel -{ - public string? QueryExpression { get; set; } - - public IEnumerable? SampleResults { get; set; } - - public int ResultCount { get; set; } - - public long ExecutionTime { get; set; } - - public int Take { get; set; } -} diff --git a/src/Umbraco.Core/Models/TemplateQuery/TemplateQueryResult.cs b/src/Umbraco.Core/Models/TemplateQuery/TemplateQueryResult.cs deleted file mode 100644 index c5e9b5df96..0000000000 --- a/src/Umbraco.Core/Models/TemplateQuery/TemplateQueryResult.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Umbraco.Cms.Core.Models.TemplateQuery; - -[Obsolete("No longer used. Scheduled for removal in V17.")] -public class TemplateQueryResult -{ - public string? Icon { get; set; } - - public string? Name { get; set; } -} diff --git a/src/Umbraco.Core/PublishedCache/IPublishedContentCache.cs b/src/Umbraco.Core/PublishedCache/IPublishedContentCache.cs index b2f0e7e277..dd5aa53f5e 100644 --- a/src/Umbraco.Core/PublishedCache/IPublishedContentCache.cs +++ b/src/Umbraco.Core/PublishedCache/IPublishedContentCache.cs @@ -21,43 +21,4 @@ public interface IPublishedContentCache : IPublishedCache /// The content, or null. /// Considers published or unpublished content depending on defaults. Task GetByIdAsync(Guid key, bool? preview = null); - - // FIXME: All these routing methods needs to be removed, as they are no longer part of the content cache - /// - /// Gets content identified by a route. - /// - /// A value indicating whether to consider unpublished content. - /// The route - /// A value forcing the HideTopLevelNode setting. - /// the culture - /// The content, or null. - /// - /// - /// A valid route is either a simple path eg /foo/bar/nil or a root node id and a path, eg - /// 123/foo/bar/nil. - /// - /// - /// If - /// - /// is null then the settings value is used. - /// - /// The value of overrides defaults. - /// - [Obsolete] - string? GetRouteById(bool preview, int contentId, string? culture = null); - - /// - /// Gets the route for a content identified by its unique identifier. - /// - /// The content unique identifier. - /// The culture - /// A special string formatted route path. - /// Considers published or unpublished content depending on defaults. - /// - /// The resulting string is a special encoded route string that may contain the domain ID - /// for the current route. If a domain is present the string will be prefixed with the domain ID integer, example: - /// {domainId}/route-path-of-item - /// - [Obsolete] - string? GetRouteById(int contentId, string? culture = null); } diff --git a/src/Umbraco.Core/PublishedCache/PublishedElementPropertyBase.cs b/src/Umbraco.Core/PublishedCache/PublishedElementPropertyBase.cs index af5b658b9f..dc4cb8ce7a 100644 --- a/src/Umbraco.Core/PublishedCache/PublishedElementPropertyBase.cs +++ b/src/Umbraco.Core/PublishedCache/PublishedElementPropertyBase.cs @@ -46,10 +46,6 @@ internal sealed class PublishedElementPropertyBase : PublishedPropertyBase // ReSharper disable InconsistentlySynchronizedField private string ValuesCacheKey => _valuesCacheKey ??= PropertyCacheValuesKey(); - [Obsolete("Do not use this. Will be removed in V17.")] - public static string PropertyCacheValues(Guid contentUid, string typeAlias, bool previewing) => - "PublishedSnapshot.Property.CacheValues[" + (previewing ? "D:" : "P:") + contentUid + ":" + typeAlias + "]"; - private string PropertyCacheValuesKey() => $"PublishedSnapshot.Property.CacheValues[{(IsPreviewing ? "D:" : "P:")}{Element.Key}:{Alias}:{_variationContext.Culture.IfNullOrWhiteSpace("inv")}+{_variationContext.Segment.IfNullOrWhiteSpace("inv")}]"; diff --git a/src/Umbraco.Core/Routing/AliasUrlProvider.cs b/src/Umbraco.Core/Routing/AliasUrlProvider.cs index 0809108564..6166461a74 100644 --- a/src/Umbraco.Core/Routing/AliasUrlProvider.cs +++ b/src/Umbraco.Core/Routing/AliasUrlProvider.cs @@ -1,9 +1,6 @@ -using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Umbraco.Cms.Core.Configuration.Models; -using Umbraco.Cms.Core.DependencyInjection; using Umbraco.Cms.Core.Models.PublishedContent; -using Umbraco.Cms.Core.PublishedCache; using Umbraco.Cms.Core.Services.Navigation; using Umbraco.Cms.Core.Web; using Umbraco.Extensions; @@ -43,65 +40,6 @@ public class AliasUrlProvider : IUrlProvider requestConfig.OnChange(x => _requestConfig = x); } - [Obsolete("Use the non-obsolete constructor. Scheduled for removal in V17.")] - public AliasUrlProvider( - IOptionsMonitor requestConfig, - ISiteDomainMapper siteDomainMapper, - UriUtility uriUtility, - IPublishedValueFallback publishedValueFallback, - IUmbracoContextAccessor umbracoContextAccessor, - IPublishedContentCache contentCache, - IDocumentNavigationQueryService navigationQueryService, - IPublishedContentStatusFilteringService publishedContentStatusFilteringService) - : this( - requestConfig, - siteDomainMapper, - uriUtility, - publishedValueFallback, - umbracoContextAccessor, - navigationQueryService, - publishedContentStatusFilteringService) - { - } - - [Obsolete("Use the non-obsolete constructor. Scheduled for removal in V17.")] - public AliasUrlProvider( - IOptionsMonitor requestConfig, - ISiteDomainMapper siteDomainMapper, - UriUtility uriUtility, - IPublishedValueFallback publishedValueFallback, - IUmbracoContextAccessor umbracoContextAccessor, - IPublishedContentCache contentCache, - IDocumentNavigationQueryService navigationQueryService) - : this( - requestConfig, - siteDomainMapper, - uriUtility, - publishedValueFallback, - umbracoContextAccessor, - navigationQueryService, - StaticServiceProvider.Instance.GetRequiredService()) - { - } - - [Obsolete("Use the non-obsolete constructor. Scheduled for removal in V17.")] - public AliasUrlProvider( - IOptionsMonitor requestConfig, - ISiteDomainMapper siteDomainMapper, - UriUtility uriUtility, - IPublishedValueFallback publishedValueFallback, - IUmbracoContextAccessor umbracoContextAccessor) - : this( - requestConfig, - siteDomainMapper, - uriUtility, - publishedValueFallback, - umbracoContextAccessor, - StaticServiceProvider.Instance.GetRequiredService(), - StaticServiceProvider.Instance.GetRequiredService()) - { - } - // note - at the moment we seem to accept pretty much anything as an alias // without any form of validation ... could even prob. kill the XPath ... // ok, this is somewhat experimental and is NOT enabled by default diff --git a/src/Umbraco.Core/Routing/DefaultUrlProvider.cs b/src/Umbraco.Core/Routing/DefaultUrlProvider.cs index d06abb6c2b..5ffcf6deef 100644 --- a/src/Umbraco.Core/Routing/DefaultUrlProvider.cs +++ b/src/Umbraco.Core/Routing/DefaultUrlProvider.cs @@ -25,6 +25,7 @@ public class DefaultUrlProvider : IUrlProvider private readonly IUmbracoContextAccessor _umbracoContextAccessor; private readonly IDocumentNavigationQueryService _navigationQueryService; private readonly IPublishedContentStatusFilteringService _publishedContentStatusFilteringService; + private readonly IPublishedUrlProvider _publishedUrlProvider; private readonly UriUtility _uriUtility; private RequestHandlerSettings _requestSettings; @@ -36,7 +37,8 @@ public class DefaultUrlProvider : IUrlProvider UriUtility uriUtility, ILocalizationService localizationService, IDocumentNavigationQueryService navigationQueryService, - IPublishedContentStatusFilteringService publishedContentStatusFilteringService) + IPublishedContentStatusFilteringService publishedContentStatusFilteringService, + IPublishedUrlProvider publishedUrlProvider) { _requestSettings = requestSettings.CurrentValue; _logger = logger; @@ -46,10 +48,34 @@ public class DefaultUrlProvider : IUrlProvider _localizationService = localizationService; _navigationQueryService = navigationQueryService; _publishedContentStatusFilteringService = publishedContentStatusFilteringService; + _publishedUrlProvider = publishedUrlProvider; requestSettings.OnChange(x => _requestSettings = x); } + [Obsolete("Use the other constructor - Scheduled for removal in V18")] + public DefaultUrlProvider( + IOptionsMonitor requestSettings, + ILogger logger, + ISiteDomainMapper siteDomainMapper, + IUmbracoContextAccessor umbracoContextAccessor, + UriUtility uriUtility, + ILocalizationService localizationService, + IDocumentNavigationQueryService navigationQueryService, + IPublishedContentStatusFilteringService publishedContentStatusFilteringService) + : this( + requestSettings, + logger, + siteDomainMapper, + umbracoContextAccessor, + uriUtility, + localizationService, + navigationQueryService, + publishedContentStatusFilteringService, + StaticServiceProvider.Instance.GetRequiredService()) + { + } + #region GetOtherUrls /// @@ -98,7 +124,7 @@ public class DefaultUrlProvider : IUrlProvider var culture = d.Culture; // although we are passing in culture here, if any node in this path is invariant, it ignores the culture anyways so this is ok - var route = umbracoContext.Content?.GetRouteById(id, culture); + var route = _publishedUrlProvider.GetUrl(d.Id, UrlMode.Default, culture, current); if (route == null) { continue; @@ -129,7 +155,7 @@ public class DefaultUrlProvider : IUrlProvider IUmbracoContext umbracoContext = _umbracoContextAccessor.GetRequiredUmbracoContext(); // will not use cache if previewing - var route = umbracoContext.Content?.GetRouteById(content.Id, culture); + var route = _publishedUrlProvider.GetUrl(content.Id, mode, culture, current); return GetUrlFromRoute(route, umbracoContext, content.Id, current, mode, culture); } diff --git a/src/Umbraco.Core/Routing/DomainUtilities.cs b/src/Umbraco.Core/Routing/DomainUtilities.cs index 03ddd438d3..4127036721 100644 --- a/src/Umbraco.Core/Routing/DomainUtilities.cs +++ b/src/Umbraco.Core/Routing/DomainUtilities.cs @@ -17,43 +17,6 @@ namespace Umbraco.Cms.Core.Routing { #region Document Culture - [Obsolete("Use the overload with IPublishedStatusFilteringService, scheduled for removal in v17")] - public static string? GetCultureFromDomains( - int contentId, - string contentPath, - Uri? current, - IUmbracoContext umbracoContext, - ISiteDomainMapper siteDomainMapper) - => GetCultureFromDomains( - contentId, - contentPath, - current, - umbracoContext, - siteDomainMapper, - StaticServiceProvider.Instance.GetRequiredService(), - StaticServiceProvider.Instance.GetRequiredService(), - StaticServiceProvider.Instance.GetRequiredService()); - - [Obsolete("Use the overload with IPublishedStatusFilteringService, scheduled for removal in v17")] - public static string? GetCultureFromDomains( - int contentId, - string contentPath, - Uri? current, - IUmbracoContext umbracoContext, - ISiteDomainMapper siteDomainMapper, - IDomainCache domainCache, - IPublishedCache publishedCache, - INavigationQueryService navigationQueryService) - => GetCultureFromDomains( - contentId, - contentPath, - current, - umbracoContext, - siteDomainMapper, - domainCache, - navigationQueryService, - StaticServiceProvider.Instance.GetRequiredService()); - /// /// Gets the culture assigned to a document by domains, in the context of a current Uri. /// diff --git a/src/Umbraco.Core/Routing/NewDefaultUrlProvider.cs b/src/Umbraco.Core/Routing/NewDefaultUrlProvider.cs index 4c4a3dbca6..0974ddf8ef 100644 --- a/src/Umbraco.Core/Routing/NewDefaultUrlProvider.cs +++ b/src/Umbraco.Core/Routing/NewDefaultUrlProvider.cs @@ -32,9 +32,7 @@ public class NewDefaultUrlProvider : IUrlProvider private RequestHandlerSettings _requestSettings; private readonly ILanguageService _languageService; - // TODO (V17): When removing the obsolete constructors, remove the unused localizationService parameter from the constructor (we can't do it now - // because it is used in the obsolete constructors and leads to an ambigious constructor error). - // See also if we can make GetUrlFromRoute asynchronous and avoid the GetAwaiter().GetResult() in when using ILanguageService. + // TODO See if we can make GetUrlFromRoute asynchronous and avoid the GetAwaiter().GetResult() in when using ILanguageService. /// /// Initializes a new instance of the class. @@ -45,11 +43,6 @@ public class NewDefaultUrlProvider : IUrlProvider ISiteDomainMapper siteDomainMapper, IUmbracoContextAccessor umbracoContextAccessor, UriUtility uriUtility, -#pragma warning disable CS0618 // Type or member is obsolete -#pragma warning disable IDE0060 // Remove unused parameter - ILocalizationService localizationService, -#pragma warning restore IDE0060 // Remove unused parameter -#pragma warning restore CS0618 // Type or member is obsolete IPublishedContentCache publishedContentCache, IDomainCache domainCache, IIdKeyMap idKeyMap, @@ -74,72 +67,6 @@ public class NewDefaultUrlProvider : IUrlProvider requestSettings.OnChange(x => _requestSettings = x); } - /// - /// Initializes a new instance of the class. - /// - [Obsolete("Use the non-obsolete constructor. Scheduled for removal in V17.")] - public NewDefaultUrlProvider( - IOptionsMonitor requestSettings, - ILogger logger, - ISiteDomainMapper siteDomainMapper, - IUmbracoContextAccessor umbracoContextAccessor, - UriUtility uriUtility, - ILocalizationService localizationService, - IPublishedContentCache publishedContentCache, - IDomainCache domainCache, - IIdKeyMap idKeyMap, - IDocumentUrlService documentUrlService, - IDocumentNavigationQueryService navigationQueryService, - IPublishedContentStatusFilteringService publishedContentStatusFilteringService) - : this( - requestSettings, - logger, - siteDomainMapper, - umbracoContextAccessor, - uriUtility, - localizationService, - publishedContentCache, - domainCache, - idKeyMap, - documentUrlService, - navigationQueryService, - publishedContentStatusFilteringService, - StaticServiceProvider.Instance.GetRequiredService()) - { - } - - /// - /// Initializes a new instance of the class. - /// - [Obsolete("Use the non-obsolete constructor. Scheduled for removal in V17.")] - public NewDefaultUrlProvider( - IOptionsMonitor requestSettings, - ILogger logger, - ISiteDomainMapper siteDomainMapper, - IUmbracoContextAccessor umbracoContextAccessor, - UriUtility uriUtility, - ILocalizationService localizationService, - IPublishedContentCache publishedContentCache, - IDomainCache domainCache, - IIdKeyMap idKeyMap, - IDocumentUrlService documentUrlService, - IDocumentNavigationQueryService navigationQueryService) - : this( - requestSettings, - logger, - siteDomainMapper, - umbracoContextAccessor, - uriUtility, - localizationService, - publishedContentCache, - domainCache, - idKeyMap, - documentUrlService, - navigationQueryService, - StaticServiceProvider.Instance.GetRequiredService()) - { - } - /// /// Gets the other URLs of a published content. /// diff --git a/src/Umbraco.Core/Routing/UrlProvider.cs b/src/Umbraco.Core/Routing/UrlProvider.cs index 16dc21956b..7adcbdc848 100644 --- a/src/Umbraco.Core/Routing/UrlProvider.cs +++ b/src/Umbraco.Core/Routing/UrlProvider.cs @@ -45,87 +45,6 @@ namespace Umbraco.Cms.Core.Routing Mode = routingSettings.Value.UrlProviderMode; } - [Obsolete("Use the non-obsolete constructor. Scheduled for removal in V17.")] - public UrlProvider( - IUmbracoContextAccessor umbracoContextAccessor, - IOptions routingSettings, - UrlProviderCollection urlProviders, - MediaUrlProviderCollection mediaUrlProviders, - IVariationContextAccessor variationContextAccessor, - IPublishedContentCache contentCache, - IDocumentNavigationQueryService navigationQueryService, - IPublishStatusQueryService publishStatusQueryService, - IPublishedContentStatusFilteringService publishedContentStatusFilteringService) - : this( - umbracoContextAccessor, - routingSettings, - urlProviders, - mediaUrlProviders, - variationContextAccessor, - navigationQueryService, - publishedContentStatusFilteringService) - { - } - - [Obsolete("Use the non-obsolete constructor. Scheduled for removal in V17.")] - public UrlProvider( - IUmbracoContextAccessor umbracoContextAccessor, - IOptions routingSettings, - UrlProviderCollection urlProviders, - MediaUrlProviderCollection mediaUrlProviders, - IVariationContextAccessor variationContextAccessor, - IPublishedContentCache contentCache, - IDocumentNavigationQueryService navigationQueryService, - IPublishStatusQueryService publishStatusQueryService) - : this( - umbracoContextAccessor, - routingSettings, - urlProviders, - mediaUrlProviders, - variationContextAccessor, - navigationQueryService, - StaticServiceProvider.Instance.GetRequiredService()) - { - } - - [Obsolete("Use the non-obsolete constructor. Scheduled for removal in V17.")] - public UrlProvider( - IUmbracoContextAccessor umbracoContextAccessor, - IOptions routingSettings, - UrlProviderCollection urlProviders, - MediaUrlProviderCollection mediaUrlProviders, - IVariationContextAccessor variationContextAccessor, - IPublishedContentCache contentCache, - IDocumentNavigationQueryService navigationQueryService) - : this( - umbracoContextAccessor, - routingSettings, - urlProviders, - mediaUrlProviders, - variationContextAccessor, - navigationQueryService, - StaticServiceProvider.Instance.GetRequiredService()) - { - } - - [Obsolete("Use the non-obsolete constructor. Scheduled for removal in V17.")] - public UrlProvider( - IUmbracoContextAccessor umbracoContextAccessor, - IOptions routingSettings, - UrlProviderCollection urlProviders, - MediaUrlProviderCollection mediaUrlProviders, - IVariationContextAccessor variationContextAccessor) - : this( - umbracoContextAccessor, - routingSettings, - urlProviders, - mediaUrlProviders, - variationContextAccessor, - StaticServiceProvider.Instance.GetRequiredService(), - StaticServiceProvider.Instance.GetRequiredService()) - { - } - private readonly IUmbracoContextAccessor _umbracoContextAccessor; private readonly IEnumerable _urlProviders; private readonly IEnumerable _mediaUrlProviders; diff --git a/src/Umbraco.Core/Services/ContentEditingService.cs b/src/Umbraco.Core/Services/ContentEditingService.cs index bd32e3d04a..1f7e4de5f6 100644 --- a/src/Umbraco.Core/Services/ContentEditingService.cs +++ b/src/Umbraco.Core/Services/ContentEditingService.cs @@ -64,10 +64,6 @@ internal sealed class ContentEditingService return Task.FromResult(content); } - [Obsolete("Please use the validate update method that is not obsoleted. Scheduled for removal in V17.")] - public async Task> ValidateUpdateAsync(Guid key, ValidateContentUpdateModel updateModel) - => await ValidateUpdateAsync(key, updateModel, Guid.Empty); - public async Task> ValidateUpdateAsync(Guid key, ValidateContentUpdateModel updateModel, Guid userKey) { IContent? content = ContentService.GetById(key); @@ -76,10 +72,6 @@ internal sealed class ContentEditingService : Attempt.FailWithStatus(ContentEditingOperationStatus.NotFound, new ContentValidationResult()); } - [Obsolete("Please use the validate create method that is not obsoleted. Scheduled for removal in V17.")] - public async Task> ValidateCreateAsync(ContentCreateModel createModel) - => await ValidateCreateAsync(createModel, Guid.Empty); - public async Task> ValidateCreateAsync(ContentCreateModel createModel, Guid userKey) => await ValidateCulturesAndPropertiesAsync(createModel, createModel.ContentTypeKey, await GetCulturesToValidate(createModel.Variants.Select(variant => variant.Culture), userKey)); diff --git a/src/Umbraco.Core/Services/ContentPublishingService.cs b/src/Umbraco.Core/Services/ContentPublishingService.cs index ddabe19448..b235fd8c14 100644 --- a/src/Umbraco.Core/Services/ContentPublishingService.cs +++ b/src/Umbraco.Core/Services/ContentPublishingService.cs @@ -98,8 +98,8 @@ internal sealed class ContentPublishingService : IContentPublishingService } /// - [Obsolete("Use non obsoleted version instead. Scheduled for removal in v17")] - public async Task> PublishAsync( + // TODO - Integrate this implementation into the one above. + private async Task> PublishAsync( Guid key, CultureAndScheduleModel cultureAndSchedule, Guid userKey) @@ -264,16 +264,6 @@ internal sealed class ContentPublishingService : IContentPublishingService return validationResult; } - /// - [Obsolete("This method is not longer used as the 'force' parameter has been extended into options for publishing unpublished and re-publishing changed content. Please use the overload containing the parameter for those options instead. Scheduled for removal in Umbraco 17.")] - public async Task> PublishBranchAsync(Guid key, IEnumerable cultures, bool force, Guid userKey) - => await PublishBranchAsync(key, cultures, force ? PublishBranchFilter.IncludeUnpublished : PublishBranchFilter.Default, userKey); - - /// - [Obsolete("Please use the overload containing all parameters. Scheduled for removal in Umbraco 17.")] - public async Task> PublishBranchAsync(Guid key, IEnumerable cultures, PublishBranchFilter publishBranchFilter, Guid userKey) - => await PublishBranchAsync(key, cultures, publishBranchFilter, userKey, false); - /// public async Task> PublishBranchAsync( Guid key, diff --git a/src/Umbraco.Core/Services/ContentService.cs b/src/Umbraco.Core/Services/ContentService.cs index 139c95807a..f3ae553ce4 100644 --- a/src/Umbraco.Core/Services/ContentService.cs +++ b/src/Umbraco.Core/Services/ContentService.cs @@ -2023,11 +2023,6 @@ public class ContentService : RepositoryService, IContentService return cultures; } - /// - [Obsolete("This method is not longer used as the 'force' parameter has been split into publishing unpublished and force re-published. Please use the overload containing parameters for those options instead. Scheduled for removal in V17")] - public IEnumerable PublishBranch(IContent content, bool force, string[] cultures, int userId = Constants.Security.SuperUserId) - => PublishBranch(content, force ? PublishBranchFilter.IncludeUnpublished : PublishBranchFilter.Default, cultures, userId); - /// public IEnumerable PublishBranch(IContent content, PublishBranchFilter publishBranchFilter, string[] cultures, int userId = Constants.Security.SuperUserId) { diff --git a/src/Umbraco.Core/Services/ContentTypeEditing/ContentTypeEditingService.cs b/src/Umbraco.Core/Services/ContentTypeEditing/ContentTypeEditingService.cs index a9455d9a55..c8fe7fe775 100644 --- a/src/Umbraco.Core/Services/ContentTypeEditing/ContentTypeEditingService.cs +++ b/src/Umbraco.Core/Services/ContentTypeEditing/ContentTypeEditingService.cs @@ -34,25 +34,6 @@ internal sealed class ContentTypeEditingService : ContentTypeEditingServiceBase< _reservedFieldNamesService = reservedFieldNamesService; } - [Obsolete("Use the constructor that is not marked obsolete, will be removed in v17")] - public ContentTypeEditingService( - IContentTypeService contentTypeService, - ITemplateService templateService, - IDataTypeService dataTypeService, - IEntityService entityService, - IShortStringHelper shortStringHelper, - IElementSwitchValidator elementSwitchValidator) - : this( - contentTypeService, - templateService, - dataTypeService, - entityService, - shortStringHelper, - elementSwitchValidator, - StaticServiceProvider.Instance.GetRequiredService()) - { - } - public async Task> CreateAsync(ContentTypeCreateModel model, Guid userKey) { Attempt result = await ValidateAndMapForCreationAsync(model, model.Key, model.ContainerKey); diff --git a/src/Umbraco.Core/Services/DataTypeService.cs b/src/Umbraco.Core/Services/DataTypeService.cs index 59daedcb30..4089a4c09f 100644 --- a/src/Umbraco.Core/Services/DataTypeService.cs +++ b/src/Umbraco.Core/Services/DataTypeService.cs @@ -742,27 +742,6 @@ namespace Umbraco.Cms.Core.Services.Implement return Attempt.SucceedWithStatus(DataTypeOperationStatus.Success, dataType); } - /// - public Task>, DataTypeOperationStatus>> GetReferencesAsync(Guid id) - { - using ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true); - IDataType? dataType = GetDataTypeFromRepository(id); - if (dataType == null) - { - return Task.FromResult(Attempt.FailWithStatus>, DataTypeOperationStatus>(DataTypeOperationStatus.NotFound, new Dictionary>())); - } - - IReadOnlyDictionary> usages = _dataTypeRepository.FindUsages(dataType.Id); - return Task.FromResult(Attempt.SucceedWithStatus(DataTypeOperationStatus.Success, usages)); - } - - /// - public IReadOnlyDictionary> GetListViewReferences(int id) - { - using ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true); - return _dataTypeRepository.FindListViewUsages(id); - } - /// public Task> GetPagedRelationsAsync(Guid key, int skip, int take) { diff --git a/src/Umbraco.Core/Services/DocumentUrlService.cs b/src/Umbraco.Core/Services/DocumentUrlService.cs index c3d3904085..ae35d89a97 100644 --- a/src/Umbraco.Core/Services/DocumentUrlService.cs +++ b/src/Umbraco.Core/Services/DocumentUrlService.cs @@ -839,143 +839,6 @@ public class DocumentUrlService : IDocumentUrlService return _cache.Any(); } - /// - [Obsolete("This method is obsolete and will be removed in future versions. Use IPublishedUrlInfoProvider.GetAllAsync instead.")] - public async Task> ListUrlsAsync(Guid contentKey) - { - var result = new List(); - - Attempt documentIdAttempt = _idKeyMap.GetIdForKey(contentKey, UmbracoObjectTypes.Document); - - if (documentIdAttempt.Success is false) - { - return result; - } - - IEnumerable ancestorsOrSelfKeys = contentKey.Yield() - .Concat(_contentService.GetAncestors(documentIdAttempt.Result).Select(x => x.Key).Reverse()); - - IEnumerable languages = await _languageService.GetAllAsync(); - var cultures = languages.ToDictionary(x=>x.IsoCode); - - Guid[] ancestorsOrSelfKeysArray = ancestorsOrSelfKeys as Guid[] ?? ancestorsOrSelfKeys.ToArray(); - Dictionary>> ancestorOrSelfKeyToDomains = ancestorsOrSelfKeysArray - .ToDictionary( - x => x, - ancestorKey => - { - Attempt idAttempt = _idKeyMap.GetIdForKey(ancestorKey, UmbracoObjectTypes.Document); - - if (idAttempt.Success is false) - { - return Task.FromResult((ILookup)null!); - } - - IEnumerable domains = _domainCacheService.GetAssigned(idAttempt.Result, false); - return Task.FromResult(domains.ToLookup(x => x.Culture!)); - })!; - - foreach ((string culture, ILanguage language) in cultures) - { - var urlSegments = new List(); - var foundDomains = new List(); - - var hasUrlInCulture = true; - foreach (Guid ancestorOrSelfKey in ancestorsOrSelfKeysArray) - { - ILookup domainLookup = await ancestorOrSelfKeyToDomains[ancestorOrSelfKey]; - if (domainLookup.Any()) - { - IEnumerable domains = domainLookup[culture]; - foreach (Domain domain in domains) - { - Attempt domainKeyAttempt = - _idKeyMap.GetKeyForId(domain.ContentId, UmbracoObjectTypes.Document); - if (domainKeyAttempt.Success) - { - if (_publishStatusQueryService.IsDocumentPublished(domainKeyAttempt.Result, culture)) - { - foundDomains.Add(domain); - } - } - } - - if (foundDomains.Any()) - { - break; - } - } - - if (TryGetPrimaryUrlSegment(ancestorOrSelfKey, culture, false, out string? segment)) - { - urlSegments.Add(segment); - } - else - { - hasUrlInCulture = false; - } - } - - // If we did not find a domain and this is not the default language, then the content is not routable - if (foundDomains.Any() is false && language.IsDefault is false) - { - continue; - } - - - var isRootFirstItem = GetTopMostRootKey(false, culture) == ancestorsOrSelfKeysArray.Last(); - - var leftToRight = _globalSettings.ForceCombineUrlPathLeftToRight - || CultureInfo.GetCultureInfo(culture).TextInfo.IsRightToLeft is false; - if (leftToRight) - { - urlSegments.Reverse(); - } - - // If no domain was found, we need to add a null domain to the list to make sure we check for no domains. - if (foundDomains.Any() is false) - { - foundDomains.Add(null); - } - - foreach (Domain? foundDomain in foundDomains) - { - var foundUrl = GetFullUrl(isRootFirstItem, urlSegments, foundDomain, leftToRight); - - if (foundDomain is not null) - { - // if we found a domain, it should be safe to show url - result.Add(new UrlInfo( - text: foundUrl, - isUrl: hasUrlInCulture, - culture: culture)); - } - else - { - // otherwise we need to ensure that no other page has the same url - // e.g. a site with two roots that both have a child with the same name - Guid? documentKeyByRoute = GetDocumentKeyByRoute(foundUrl, culture, foundDomain?.ContentId, false); - if (contentKey.Equals(documentKeyByRoute)) - { - result.Add(new UrlInfo( - text: foundUrl, - isUrl: hasUrlInCulture, - culture: culture)); - } - else - { - result.Add(new UrlInfo( - text: "Conflict: Other page has the same url", - isUrl: false, - culture: culture)); - } - } - } - } - - return result; - } - private bool TryGetPrimaryUrlSegment(Guid documentKey, string culture, bool isDraft, [NotNullWhen(true)] out string? segment) { if (_cache.TryGetValue( diff --git a/src/Umbraco.Core/Services/ExternalLoginService.cs b/src/Umbraco.Core/Services/ExternalLoginService.cs index df64e2e355..29c503629d 100644 --- a/src/Umbraco.Core/Services/ExternalLoginService.cs +++ b/src/Umbraco.Core/Services/ExternalLoginService.cs @@ -1,6 +1,4 @@ -using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using Umbraco.Cms.Core.DependencyInjection; using Umbraco.Cms.Core.Events; using Umbraco.Cms.Core.Persistence.Repositories; using Umbraco.Cms.Core.Scoping; @@ -13,21 +11,6 @@ public class ExternalLoginService : RepositoryService, IExternalLoginWithKeyServ private readonly IExternalLoginWithKeyRepository _externalLoginRepository; private readonly IUserRepository _userRepository; - [Obsolete("Please use the constructor taking all parameters. Scheduled for removal in Umbraco 17.")] - public ExternalLoginService( - ICoreScopeProvider provider, - ILoggerFactory loggerFactory, - IEventMessagesFactory eventMessagesFactory, - IExternalLoginWithKeyRepository externalLoginRepository) - : this( - provider, - loggerFactory, - eventMessagesFactory, - externalLoginRepository, - StaticServiceProvider.Instance.GetRequiredService()) - { - } - public ExternalLoginService( ICoreScopeProvider provider, ILoggerFactory loggerFactory, diff --git a/src/Umbraco.Core/Services/Filters/IContentTypeFilter.cs b/src/Umbraco.Core/Services/Filters/IContentTypeFilter.cs index 552714989c..9f8a0feb02 100644 --- a/src/Umbraco.Core/Services/Filters/IContentTypeFilter.cs +++ b/src/Umbraco.Core/Services/Filters/IContentTypeFilter.cs @@ -16,16 +16,6 @@ public interface IContentTypeFilter where TItem : IContentTypeComposition => Task.FromResult(contentTypes); - /// - /// Filters the content types retrieved for being allowed as children of a parent content type. - /// - /// Retrieved collection of content types. - /// The parent content key. - /// Filtered collection of content types. - [Obsolete("Please use the method overload taking all parameters. Scheduled for removal in Umbraco 17.")] - Task> FilterAllowedChildrenAsync(IEnumerable contentTypes, Guid parentKey) - => Task.FromResult(contentTypes); - /// /// Filters the content types retrieved for being allowed as children of a parent content type. /// @@ -33,8 +23,6 @@ public interface IContentTypeFilter /// The parent content type key. /// The parent content key (provided to allow for custom filtering of the returned list of children based on the content context). /// Filtered collection of content types. - Task> FilterAllowedChildrenAsync(IEnumerable contentTypes, Guid parentContentTypeKey, Guid? parentContentKey) -#pragma warning disable CS0618 // Type or member is obsolete - => FilterAllowedChildrenAsync(contentTypes, parentContentTypeKey); -#pragma warning restore CS0618 // Type or member is obsolete + Task> FilterAllowedChildrenAsync(IEnumerable contentTypes, + Guid parentContentTypeKey, Guid? parentContentKey); } diff --git a/src/Umbraco.Core/Services/IContentEditingService.cs b/src/Umbraco.Core/Services/IContentEditingService.cs index be8325de81..0d1ef9ae42 100644 --- a/src/Umbraco.Core/Services/IContentEditingService.cs +++ b/src/Umbraco.Core/Services/IContentEditingService.cs @@ -8,21 +8,9 @@ public interface IContentEditingService { Task GetAsync(Guid key); - [Obsolete("Please use the validate create method that is not obsoleted. Scheduled for removal in Umbraco 17.")] - Task> ValidateCreateAsync(ContentCreateModel createModel); + Task> ValidateCreateAsync(ContentCreateModel createModel, Guid userKey); - Task> ValidateCreateAsync(ContentCreateModel createModel, Guid userKey) -#pragma warning disable CS0618 // Type or member is obsolete - => ValidateCreateAsync(createModel); -#pragma warning restore CS0618 // Type or member is obsolete - - [Obsolete("Please use the validate update method that is not obsoleted. Scheduled for removal in Umbraco 17.")] - Task> ValidateUpdateAsync(Guid key, ValidateContentUpdateModel updateModel); - - Task> ValidateUpdateAsync(Guid key, ValidateContentUpdateModel updateModel, Guid userKey) -#pragma warning disable CS0618 // Type or member is obsolete - => ValidateUpdateAsync(key, updateModel); -#pragma warning restore CS0618 // Type or member is obsolete + Task> ValidateUpdateAsync(Guid key, ValidateContentUpdateModel updateModel, Guid userKey); Task> CreateAsync(ContentCreateModel createModel, Guid userKey); diff --git a/src/Umbraco.Core/Services/IContentPublishingService.cs b/src/Umbraco.Core/Services/IContentPublishingService.cs index f2d7edef2c..661e7e54ef 100644 --- a/src/Umbraco.Core/Services/IContentPublishingService.cs +++ b/src/Umbraco.Core/Services/IContentPublishingService.cs @@ -3,47 +3,11 @@ using Umbraco.Cms.Core.DependencyInjection; using Umbraco.Cms.Core.Models; using Umbraco.Cms.Core.Models.ContentPublishing; using Umbraco.Cms.Core.Services.OperationStatus; -using static Umbraco.Cms.Core.Constants.Conventions; namespace Umbraco.Cms.Core.Services; public interface IContentPublishingService { - /// - /// Publishes a single content item. - /// - /// The key of the root content. - /// The cultures to publish and their publishing schedules. - /// The identifier of the user performing the operation. - /// Result of the publish operation. - [Obsolete("Use non obsoleted version instead. Scheduled for removal in v17")] - Task> PublishAsync(Guid key, CultureAndScheduleModel cultureAndSchedule, Guid userKey); - - /// - /// Publishes a content branch. - /// - /// The key of the root content. - /// The cultures to publish. - /// A value indicating whether to force-publish content that is not already published. - /// The identifier of the user performing the operation. - /// Result of the publish operation. - [Obsolete("This method is not longer used as the 'force' parameter has been extended into options for publishing unpublished and re-publishing changed content. Please use the overload containing the parameter for those options instead. Scheduled for removal in Umbraco 17.")] - Task> PublishBranchAsync(Guid key, IEnumerable cultures, bool force, Guid userKey); - - /// - /// Publishes a content branch. - /// - /// The key of the root content. - /// The cultures to publish. - /// A value indicating options for force publishing unpublished or re-publishing unchanged content. - /// The identifier of the user performing the operation. - /// Result of the publish operation. - [Obsolete("Please use the overload containing all parameters. Scheduled for removal in Umbraco 17.")] - Task> PublishBranchAsync(Guid key, IEnumerable cultures, PublishBranchFilter publishBranchFilter, Guid userKey) -#pragma warning disable CS0618 // Type or member is obsolete - => PublishBranchAsync(key, cultures, publishBranchFilter.HasFlag(PublishBranchFilter.IncludeUnpublished), userKey); -#pragma warning restore CS0618 // Type or member is obsolete - /// /// Publishes a content branch. /// @@ -53,10 +17,7 @@ public interface IContentPublishingService /// The identifier of the user performing the operation. /// Flag indicating whether to use a background thread for the operation and immediately return to the caller. /// Result of the publish operation. - Task> PublishBranchAsync(Guid key, IEnumerable cultures, PublishBranchFilter publishBranchFilter, Guid userKey, bool useBackgroundThread) -#pragma warning disable CS0618 // Type or member is obsolete - => PublishBranchAsync(key, cultures, publishBranchFilter, userKey); -#pragma warning restore CS0618 // Type or member is obsolete + Task> PublishBranchAsync(Guid key, IEnumerable cultures, PublishBranchFilter publishBranchFilter, Guid userKey, bool useBackgroundThread); /// /// Gets the status of a background task that is publishing a content branch. diff --git a/src/Umbraco.Core/Services/IContentService.cs b/src/Umbraco.Core/Services/IContentService.cs index 228d7fa6db..1307347557 100644 --- a/src/Umbraco.Core/Services/IContentService.cs +++ b/src/Umbraco.Core/Services/IContentService.cs @@ -404,23 +404,6 @@ public interface IContentService : IContentServiceBase /// The identifier of the user performing the action. PublishResult Publish(IContent content, string[] cultures, int userId = Constants.Security.SuperUserId); - /// - /// Publishes a document branch. - /// - /// The root document. - /// A value indicating whether to force-publish documents that are not already published. - /// The cultures to publish. - /// The identifier of the user performing the operation. - /// - /// - /// The parameter determines which documents are published. When false, - /// only those documents that are already published, are republished. When true, all documents are - /// published. The root of the branch is always published, regardless of . - /// - /// - [Obsolete("This method is not longer used as the 'force' parameter has been extended into options for publishing unpublished and re-publishing changed content. Please use the overload containing the parameter for those options instead. Will be removed in V17.")] - IEnumerable PublishBranch(IContent content, bool force, string[] cultures, int userId = Constants.Security.SuperUserId); - /// /// Publishes a document branch. /// diff --git a/src/Umbraco.Core/Services/IDataTypeService.cs b/src/Umbraco.Core/Services/IDataTypeService.cs index 9086e0765f..2fc82c40b7 100644 --- a/src/Umbraco.Core/Services/IDataTypeService.cs +++ b/src/Umbraco.Core/Services/IDataTypeService.cs @@ -9,17 +9,6 @@ namespace Umbraco.Cms.Core.Services; /// public interface IDataTypeService : IService { - [Obsolete("Please use GetPagedRelationsAsync. Scheduled for removal in Umbraco 17.")] - IReadOnlyDictionary> GetListViewReferences(int id) => throw new NotImplementedException(); - - /// - /// Returns a dictionary of content type s and the property type aliases that use a - /// - /// The guid Id of the - /// - [Obsolete("Please use GetPagedRelationsAsync. Scheduled for removal in Umbraco 17.")] - Task>, DataTypeOperationStatus>> GetReferencesAsync(Guid id); - /// /// Gets a paged result of items which are in relation with the current data type. /// diff --git a/src/Umbraco.Core/Services/IDocumentUrlService.cs b/src/Umbraco.Core/Services/IDocumentUrlService.cs index 052980f7f4..8020a77269 100644 --- a/src/Umbraco.Core/Services/IDocumentUrlService.cs +++ b/src/Umbraco.Core/Services/IDocumentUrlService.cs @@ -74,13 +74,6 @@ public interface IDocumentUrlService /// The document key, or null if not found. Guid? GetDocumentKeyByRoute(string route, string? culture, int? documentStartNodeId, bool isDraft); - /// - /// Gets all the URLs for a given content key. - /// - /// The content key. - [Obsolete("This method is obsolete and will be removed in future versions. Use IPublishedUrlInfoProvider.GetAllAsync instead. Scheduled for removal in Umbraco 17.")] - Task> ListUrlsAsync(Guid contentKey); - /// /// Gets the legacy route format for a document key and culture. /// diff --git a/src/Umbraco.Core/Services/IIndexedEntitySearchService.cs b/src/Umbraco.Core/Services/IIndexedEntitySearchService.cs index 4063c6ad87..147525dcae 100644 --- a/src/Umbraco.Core/Services/IIndexedEntitySearchService.cs +++ b/src/Umbraco.Core/Services/IIndexedEntitySearchService.cs @@ -12,31 +12,6 @@ namespace Umbraco.Cms.Core.Services; /// public interface IIndexedEntitySearchService { - [Obsolete("Please use the method that accepts all parameters. Will be removed in V17.")] - PagedModel Search(UmbracoObjectTypes objectType, string query, int skip = 0, int take = 100, bool ignoreUserStartNodes = false); - - // default implementation to avoid breaking changes falls back to old behaviour - [Obsolete("Please use the method that accepts all parameters. Will be removed in V17.")] - PagedModel Search(UmbracoObjectTypes objectType, string query, Guid? parentId, int skip = 0, int take = 100, bool ignoreUserStartNodes = false) - => Search(objectType,query, skip, take, ignoreUserStartNodes); - - [Obsolete("Please use the method that accepts all parameters. Will be removed in V17.")] - PagedModel Search(UmbracoObjectTypes objectType, string query, Guid? parentId, IEnumerable? contentTypeIds, int skip = 0, int take = 100, bool ignoreUserStartNodes = false) - => Search(objectType,query, skip, take, ignoreUserStartNodes); - - // default implementation to avoid breaking changes falls back to old behaviour - [Obsolete("Please use the async version of this method, SearchAsync. Scheduled for removal in V17.")] - PagedModel Search( - UmbracoObjectTypes objectType, - string query, - Guid? parentId, - IEnumerable? contentTypeIds, - bool? trashed, - int skip = 0, - int take = 100, - bool ignoreUserStartNodes = false) - => Search(objectType, query, skip, take, ignoreUserStartNodes); - Task> SearchAsync( UmbracoObjectTypes objectType, string query, diff --git a/src/Umbraco.Core/Services/IMemberService.cs b/src/Umbraco.Core/Services/IMemberService.cs index 8de0f43e11..e122f57c16 100644 --- a/src/Umbraco.Core/Services/IMemberService.cs +++ b/src/Umbraco.Core/Services/IMemberService.cs @@ -9,30 +9,6 @@ namespace Umbraco.Cms.Core.Services; /// public interface IMemberService : IMembershipMemberService, IContentServiceBase { - /// - /// Gets a list of paged objects - /// - /// An can be of type - /// Current page index - /// Size of the page - /// Total number of records found (out) - /// Field to order by - /// Direction to order by - /// - /// Search text filter - /// - /// - /// - [Obsolete("Please use the skip & take instead of pageIndex & pageSize, scheduled for removal in v17")] - IEnumerable GetAll( - long pageIndex, - int pageSize, - out long totalRecords, - string orderBy, - Direction orderDirection, - string? memberTypeAlias = null, - string filter = ""); - /// /// Gets a list of paged objects /// @@ -54,19 +30,7 @@ public interface IMemberService : IMembershipMemberService, IContentServiceBase< string orderBy, Direction orderDirection, string? memberTypeAlias = null, - string filter = "") - { - PaginationHelper.ConvertSkipTakeToPaging(skip, take, out var pageNumber, out var pageSize); - - return GetAll( - pageNumber, - pageSize, - out totalRecords, - orderBy, - orderDirection, - memberTypeAlias, - filter); - } + string filter = ""); /// /// Gets a list of paged objects diff --git a/src/Umbraco.Core/Services/IRelationService.cs b/src/Umbraco.Core/Services/IRelationService.cs index e556b2c3e4..828abc1fd1 100644 --- a/src/Umbraco.Core/Services/IRelationService.cs +++ b/src/Umbraco.Core/Services/IRelationService.cs @@ -292,24 +292,13 @@ public interface IRelationService : IService /// bool HasRelations(IRelationType relationType); - /// - /// Checks whether any relations exists for the passed in Id. - /// - /// Id of an object to check relations for - /// Returns True if any relations exists with the given Id, otherwise False - [Obsolete("Please use the overload taking a RelationDirectionFilter parameter. Scheduled for removal in Umbraco 17.")] - bool IsRelated(int id); - /// /// Checks whether any relations exists for the passed in Id and direction. /// /// Id of an object to check relations for /// Indicates whether to check for relations as parent, child or in either direction. /// Returns True if any relations exists with the given Id, otherwise False - bool IsRelated(int id, RelationDirectionFilter directionFilter) -#pragma warning disable CS0618 // Type or member is obsolete - => IsRelated(id); -#pragma warning restore CS0618 // Type or member is obsolete + bool IsRelated(int id, RelationDirectionFilter directionFilter); /// /// Checks whether two items are related diff --git a/src/Umbraco.Core/Services/MemberService.cs b/src/Umbraco.Core/Services/MemberService.cs index 4186739714..220fb250d8 100644 --- a/src/Umbraco.Core/Services/MemberService.cs +++ b/src/Umbraco.Core/Services/MemberService.cs @@ -410,14 +410,14 @@ namespace Umbraco.Cms.Core.Services } public IEnumerable GetAll( - long pageIndex, - int pageSize, + int skip, + int take, out long totalRecords, string orderBy, Direction orderDirection, string? memberTypeAlias = null, string filter = "") => - GetAll(pageIndex, pageSize, out totalRecords, orderBy, orderDirection, true, memberTypeAlias, filter); + GetAll(skip, take, out totalRecords, orderBy, orderDirection, true, memberTypeAlias, filter); public IEnumerable GetAll( long pageIndex, diff --git a/src/Umbraco.Core/Services/PropertyValidationService.cs b/src/Umbraco.Core/Services/PropertyValidationService.cs index 1c44d71cf1..fe2d3c998c 100644 --- a/src/Umbraco.Core/Services/PropertyValidationService.cs +++ b/src/Umbraco.Core/Services/PropertyValidationService.cs @@ -22,24 +22,6 @@ public class PropertyValidationService : IPropertyValidationService private readonly ILanguageService _languageService; private readonly ContentSettings _contentSettings; - [Obsolete("Use the constructor that accepts ILanguageService and ContentSettings options. Will be removed in V17.")] - public PropertyValidationService( - PropertyEditorCollection propertyEditors, - IDataTypeService dataTypeService, - ILocalizedTextService textService, - IValueEditorCache valueEditorCache, - ICultureDictionary cultureDictionary) - : this( - propertyEditors, - dataTypeService, - textService, - valueEditorCache, - cultureDictionary, - StaticServiceProvider.Instance.GetRequiredService(), - StaticServiceProvider.Instance.GetRequiredService>()) - { - } - public PropertyValidationService( PropertyEditorCollection propertyEditors, IDataTypeService dataTypeService, diff --git a/src/Umbraco.Core/Services/PublishStatus/PublishStatusService.cs b/src/Umbraco.Core/Services/PublishStatus/PublishStatusService.cs index d221149439..63d6d657fc 100644 --- a/src/Umbraco.Core/Services/PublishStatus/PublishStatusService.cs +++ b/src/Umbraco.Core/Services/PublishStatus/PublishStatusService.cs @@ -1,6 +1,4 @@ -using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using Umbraco.Cms.Core.DependencyInjection; using Umbraco.Cms.Core.Persistence.Repositories; using Umbraco.Cms.Core.Scoping; @@ -22,41 +20,6 @@ public class PublishStatusService : IPublishStatusManagementService, IPublishSta private string? DefaultCulture { get; set; } - /// - /// Initializes a new instance of the class. - /// - [Obsolete("Use non-obsolete constructor. This will be removed in Umbraco 17.")] - public PublishStatusService( - ILogger logger, - IPublishStatusRepository publishStatusRepository, - ICoreScopeProvider coreScopeProvider) - : this( - logger, - publishStatusRepository, - coreScopeProvider, - StaticServiceProvider.Instance.GetRequiredService(), - StaticServiceProvider.Instance.GetRequiredService()) - { - } - - /// - /// Initializes a new instance of the class. - /// - [Obsolete("Use non-obsolete constructor. This will be removed in Umbraco 17.")] - public PublishStatusService( - ILogger logger, - IPublishStatusRepository publishStatusRepository, - ICoreScopeProvider coreScopeProvider, - ILanguageService languageService) - : this( - logger, - publishStatusRepository, - coreScopeProvider, - languageService, - StaticServiceProvider.Instance.GetRequiredService()) - { - } - /// /// Initializes a new instance of the class. /// diff --git a/src/Umbraco.Core/Services/WebhookRequestService.cs b/src/Umbraco.Core/Services/WebhookRequestService.cs index dae4d4afac..53ff1b7abb 100644 --- a/src/Umbraco.Core/Services/WebhookRequestService.cs +++ b/src/Umbraco.Core/Services/WebhookRequestService.cs @@ -1,6 +1,4 @@ -using Microsoft.Extensions.DependencyInjection; -using Umbraco.Cms.Core.DependencyInjection; -using Umbraco.Cms.Core.Models; +using Umbraco.Cms.Core.Models; using Umbraco.Cms.Core.Persistence.Repositories; using Umbraco.Cms.Core.Scoping; using Umbraco.Cms.Core.Serialization; @@ -13,12 +11,6 @@ public class WebhookRequestService : IWebhookRequestService private readonly IWebhookRequestRepository _webhookRequestRepository; private readonly IWebhookJsonSerializer _webhookJsonSerializer; - [Obsolete("This constructor is obsolete and will be removed in future versions. Scheduled for removal in V17")] - public WebhookRequestService(ICoreScopeProvider coreScopeProvider, IWebhookRequestRepository webhookRequestRepository, IJsonSerializer jsonSerializer) - : this (coreScopeProvider, webhookRequestRepository, StaticServiceProvider.Instance.GetRequiredService()) - { - } - public WebhookRequestService(ICoreScopeProvider coreScopeProvider, IWebhookRequestRepository webhookRequestRepository, IWebhookJsonSerializer webhookJsonSerializer) { _coreScopeProvider = coreScopeProvider; diff --git a/src/Umbraco.Core/Templates/HtmlLocalLinkParser.cs b/src/Umbraco.Core/Templates/HtmlLocalLinkParser.cs index 4714ebcd2e..ba6018d1b3 100644 --- a/src/Umbraco.Core/Templates/HtmlLocalLinkParser.cs +++ b/src/Umbraco.Core/Templates/HtmlLocalLinkParser.cs @@ -117,7 +117,7 @@ public sealed class HtmlLocalLinkParser } } - [Obsolete("This is a temporary method to support legacy formats until we are sure all data has been migration. Scheduled for removal in v17")] + [Obsolete("This is a temporary method to support legacy formats until we are sure all data has been migration. Scheduled for removal in v18")] public IEnumerable FindLegacyLocalLinkIds(string text) { // Parse internal links @@ -147,7 +147,7 @@ public sealed class HtmlLocalLinkParser } } - [Obsolete("This is a temporary method to support legacy formats until we are sure all data has been migration. Scheduled for removal in v17")] + [Obsolete("This is a temporary method to support legacy formats until we are sure all data has been migration. Scheduled for removal in v18")] public class LocalLinkTag { public LocalLinkTag(int? intId, GuidUdi? udi, string tagHref) diff --git a/src/Umbraco.Infrastructure/Services/Implement/IndexedEntitySearchService.cs b/src/Umbraco.Infrastructure/Services/Implement/IndexedEntitySearchService.cs index c72771ba67..fa7673a359 100644 --- a/src/Umbraco.Infrastructure/Services/Implement/IndexedEntitySearchService.cs +++ b/src/Umbraco.Infrastructure/Services/Implement/IndexedEntitySearchService.cs @@ -42,39 +42,6 @@ internal sealed class IndexedEntitySearchService : IIndexedEntitySearchService _memberTypeService = memberTypeService; } - public PagedModel Search(UmbracoObjectTypes objectType, string query, int skip = 0, int take = 100, bool ignoreUserStartNodes = false) - => Search(objectType, query, null, skip, take, ignoreUserStartNodes); - - public PagedModel Search( - UmbracoObjectTypes objectType, - string query, - Guid? parentId, - int skip = 0, - int take = 100, - bool ignoreUserStartNodes = false) - => Search(objectType, query, parentId, null, null, skip, take, ignoreUserStartNodes); - - public PagedModel Search( - UmbracoObjectTypes objectType, - string query, - Guid? parentId, - IEnumerable? contentTypeIds, - int skip = 0, - int take = 100, - bool ignoreUserStartNodes = false) - => Search(objectType, query, parentId, contentTypeIds, null, skip, take, ignoreUserStartNodes); - - public PagedModel Search( - UmbracoObjectTypes objectType, - string query, - Guid? parentId, - IEnumerable? contentTypeIds, - bool? trashed, - int skip = 0, - int take = 100, - bool ignoreUserStartNodes = false) - => SearchAsync(objectType, query, parentId, contentTypeIds, trashed, null, skip, take, ignoreUserStartNodes).GetAwaiter().GetResult(); - public Task> SearchAsync( UmbracoObjectTypes objectType, string query, diff --git a/src/Umbraco.PublishedCache.HybridCache/DocumentCache.cs b/src/Umbraco.PublishedCache.HybridCache/DocumentCache.cs index 6e48b6f450..bebb34e67c 100644 --- a/src/Umbraco.PublishedCache.HybridCache/DocumentCache.cs +++ b/src/Umbraco.PublishedCache.HybridCache/DocumentCache.cs @@ -52,15 +52,4 @@ public sealed class DocumentCache : IPublishedContentCache IEnumerable rootContent = rootKeys.Select(key => GetById(preview, key)).WhereNotNull(); return culture is null ? rootContent : rootContent.Where(x => x.IsInvariantOrHasCulture(culture)); } - - [Obsolete("Use IPublishedUrlProvider.GetUrl instead, scheduled for removal in v17")] - public string? GetRouteById(bool preview, int contentId, string? culture = null) - { - IPublishedContent? content = GetById(preview, contentId); - - return content is not null ? _publishedUrlProvider.Value.GetUrl(content, UrlMode.Relative, culture) : null; - } - - [Obsolete("Use IPublishedUrlProvider.GetUrl instead, scheduled for removal in v17")] - public string? GetRouteById(int contentId, string? culture = null) => GetRouteById(false, contentId, culture); } diff --git a/src/Umbraco.Web.Common/Extensions/FriendlyPublishedContentExtensions.cs b/src/Umbraco.Web.Common/Extensions/FriendlyPublishedContentExtensions.cs index aea29f157e..c744ff1608 100644 --- a/src/Umbraco.Web.Common/Extensions/FriendlyPublishedContentExtensions.cs +++ b/src/Umbraco.Web.Common/Extensions/FriendlyPublishedContentExtensions.cs @@ -727,7 +727,7 @@ public static class FriendlyPublishedContentExtensions public static string? GetCultureFromDomains( this IPublishedContent content, Uri? current = null) - => content.GetCultureFromDomains(UmbracoContextAccessor, SiteDomainHelper, DomainCache, PublishedContentCache, DocumentNavigationQueryService, current); + => content.GetCultureFromDomains(UmbracoContextAccessor, SiteDomainHelper, DomainCache, DocumentNavigationQueryService, GetPublishedStatusFilteringService(content), current); public static IEnumerable SearchDescendants( this IPublishedContent content, diff --git a/src/Umbraco.Web.Common/Extensions/PublishedContentExtensions.cs b/src/Umbraco.Web.Common/Extensions/PublishedContentExtensions.cs index d4cde7a5cf..f906ad3e26 100644 --- a/src/Umbraco.Web.Common/Extensions/PublishedContentExtensions.cs +++ b/src/Umbraco.Web.Common/Extensions/PublishedContentExtensions.cs @@ -3,6 +3,7 @@ using Examine; using Examine.Search; using Microsoft.AspNetCore.Html; using Umbraco.Cms.Core; +using Umbraco.Cms.Core.DependencyInjection; using Umbraco.Cms.Core.Models.PublishedContent; using Umbraco.Cms.Core.PublishedCache; using Umbraco.Cms.Core.Routing; @@ -17,19 +18,6 @@ public static class PublishedContentExtensions { #region Variations - public static string? GetCultureFromDomains( - this IPublishedContent content, - IUmbracoContextAccessor umbracoContextAccessor, - ISiteDomainMapper siteDomainHelper, - IDomainCache domainCache, - IPublishedCache publishedCache, - INavigationQueryService navigationQueryService, - Uri? current = null) - { - IUmbracoContext umbracoContext = umbracoContextAccessor.GetRequiredUmbracoContext(); - return DomainUtilities.GetCultureFromDomains(content.Id, content.Path, current, umbracoContext, siteDomainHelper, domainCache, publishedCache, navigationQueryService); - } - /// /// Gets the culture assigned to a document by domains, in the context of a current Uri. /// @@ -37,8 +25,8 @@ public static class PublishedContentExtensions /// /// The site domain helper. /// The domain cache. - /// The published content cache. /// The navigation query service. + /// The published status filtering service. /// An optional current Uri. /// The culture assigned to the document by domains. /// @@ -53,13 +41,12 @@ public static class PublishedContentExtensions IUmbracoContextAccessor umbracoContextAccessor, ISiteDomainMapper siteDomainHelper, IDomainCache domainCache, - IPublishedCache publishedCache, INavigationQueryService navigationQueryService, IPublishedStatusFilteringService publishedStatusFilteringService, Uri? current = null) { IUmbracoContext umbracoContext = umbracoContextAccessor.GetRequiredUmbracoContext(); - return DomainUtilities.GetCultureFromDomains(content.Id, content.Path, current, umbracoContext, siteDomainHelper, domainCache, publishedCache, navigationQueryService); + return DomainUtilities.GetCultureFromDomains(content.Id, content.Path, current, umbracoContext, siteDomainHelper, domainCache, navigationQueryService, publishedStatusFilteringService); } #endregion diff --git a/tests/Umbraco.Tests.Integration/Testing/UmbracoIntegrationTestWithContentEditing.cs b/tests/Umbraco.Tests.Integration/Testing/UmbracoIntegrationTestWithContentEditing.cs index f216017060..86e1508801 100644 --- a/tests/Umbraco.Tests.Integration/Testing/UmbracoIntegrationTestWithContentEditing.cs +++ b/tests/Umbraco.Tests.Integration/Testing/UmbracoIntegrationTestWithContentEditing.cs @@ -112,7 +112,7 @@ public abstract class UmbracoIntegrationTestWithContentEditing : UmbracoIntegrat PublishedTextPageId = createContentResultPublishPage.Result.Content.Id; } - var publishResult = await ContentPublishingService.PublishAsync(PublishedTextPage.Key.Value, CultureAndSchedule, Constants.Security.SuperUserKey); + var publishResult = await ContentPublishingService.PublishAsync(PublishedTextPage.Key.Value, [new CulturePublishScheduleModel()], Constants.Security.SuperUserKey); Assert.IsTrue(publishResult.Success); // Create and Save Content "Text Page 1" based on "umbTextpage" -> 1055 diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Core/Services/ContentServiceTests.cs b/tests/Umbraco.Tests.Integration/Umbraco.Core/Services/ContentServiceTests.cs index 65befb218f..b007634a01 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Core/Services/ContentServiceTests.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Core/Services/ContentServiceTests.cs @@ -2,10 +2,12 @@ // See LICENSE for more details. using System.Diagnostics; +using Microsoft.Extensions.Options; using Moq; using NUnit.Framework; using Umbraco.Cms.Core; using Umbraco.Cms.Core.Cache; +using Umbraco.Cms.Core.Configuration.Models; using Umbraco.Cms.Core.Dictionary; using Umbraco.Cms.Core.Events; using Umbraco.Cms.Core.Models; @@ -1268,7 +1270,7 @@ internal sealed class ContentServiceTests : UmbracoIntegrationTestWithContent Assert.IsFalse(content.HasIdentity); // content cannot publish values because they are invalid - var propertyValidationService = new PropertyValidationService(PropertyEditorCollection, DataTypeService, LocalizedTextService, ValueEditorCache, Mock.Of()); + var propertyValidationService = new PropertyValidationService(PropertyEditorCollection, DataTypeService, LocalizedTextService, ValueEditorCache, Mock.Of(), Mock.Of(), Mock.Of>()); var isValid = propertyValidationService.IsPropertyDataValid(content, out var invalidProperties, CultureImpact.Invariant); Assert.IsFalse(isValid); diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentPublishingServiceTests.Publish.cs b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentPublishingServiceTests.Publish.cs index 42b8f6297b..74bfb00b31 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentPublishingServiceTests.Publish.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentPublishingServiceTests.Publish.cs @@ -17,7 +17,7 @@ public partial class ContentPublishingServiceTests { VerifyIsNotPublished(Textpage.Key); - var result = await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey); + var result = await ContentPublishingService.PublishAsync(Textpage.Key, [new CulturePublishScheduleModel()], Constants.Security.SuperUserKey); Assert.IsTrue(result.Success); Assert.AreEqual(ContentPublishingOperationStatus.Success, result.Status); @@ -27,7 +27,7 @@ public partial class ContentPublishingServiceTests [Test] public async Task Publish_Single_Item_Does_Not_Publish_Children() { - await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync(Textpage.Key, [new CulturePublishScheduleModel()], Constants.Security.SuperUserKey); VerifyIsPublished(Textpage.Key); VerifyIsNotPublished(Subpage.Key); @@ -36,9 +36,9 @@ public partial class ContentPublishingServiceTests [Test] public async Task Can_Publish_Child_Of_Root() { - await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync(Textpage.Key, [new CulturePublishScheduleModel()], Constants.Security.SuperUserKey); - var result = await ContentPublishingService.PublishAsync(Subpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey); + var result = await ContentPublishingService.PublishAsync(Subpage.Key, [new CulturePublishScheduleModel()], Constants.Security.SuperUserKey); Assert.IsTrue(result.Success); Assert.AreEqual(ContentPublishingOperationStatus.Success, result.Status); @@ -76,7 +76,7 @@ public partial class ContentPublishingServiceTests [Test] public async Task Can_Publish_Branch_Beneath_Root() { - await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync(Textpage.Key, [new CulturePublishScheduleModel()], Constants.Security.SuperUserKey); var subpage2Subpage = ContentBuilder.CreateSimpleContent(ContentType, "Text Page 2-2", Subpage2.Id); ContentService.Save(subpage2Subpage, -1); @@ -95,7 +95,7 @@ public partial class ContentPublishingServiceTests { ContentNotificationHandler.PublishingContent = notification => notification.Cancel = true; - var result = await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey); + var result = await ContentPublishingService.PublishAsync(Textpage.Key, [new CulturePublishScheduleModel()], Constants.Security.SuperUserKey); Assert.IsFalse(result.Success); Assert.AreEqual(ContentPublishingOperationStatus.CancelledByEvent, result.Status); @@ -115,7 +115,9 @@ public partial class ContentPublishingServiceTests content.SetValue("title", "DA title", culture: langDa.IsoCode); ContentService.Save(content); - var result = await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet() { langEn.IsoCode, langDa.IsoCode }), Constants.Security.SuperUserKey); + var result = await ContentPublishingService.PublishAsync(content.Key, [ + new CulturePublishScheduleModel { Culture = langEn.IsoCode }, + new CulturePublishScheduleModel { Culture = langDa.IsoCode }], Constants.Security.SuperUserKey); Assert.IsTrue(result.Success); Assert.AreEqual(ContentPublishingOperationStatus.Success, result.Status); @@ -140,7 +142,9 @@ public partial class ContentPublishingServiceTests content.SetValue("title", "DA title", culture: langDa.IsoCode); ContentService.Save(content); - var publishResult = await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet() { langEn.IsoCode, langDa.IsoCode }), Constants.Security.SuperUserKey); + var publishResult = await ContentPublishingService.PublishAsync(content.Key, [ + new CulturePublishScheduleModel { Culture = langEn.IsoCode }, + new CulturePublishScheduleModel { Culture = langDa.IsoCode }], Constants.Security.SuperUserKey); Assert.IsTrue(publishResult.Success); Assert.AreEqual(ContentPublishingOperationStatus.Success, publishResult.Status); @@ -158,8 +162,8 @@ public partial class ContentPublishingServiceTests content = ContentService.GetById(content.Key)!; Assert.AreEqual(0, content.PublishedCultures.Count()); - publishResult = await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet() { langDa.IsoCode }), Constants.Security.SuperUserKey); - + publishResult = await ContentPublishingService.PublishAsync(content.Key, [ + new CulturePublishScheduleModel { Culture = langDa.IsoCode }], Constants.Security.SuperUserKey); Assert.IsTrue(publishResult.Success); Assert.AreEqual(ContentPublishingOperationStatus.Success, publishResult.Status); @@ -221,7 +225,8 @@ public partial class ContentPublishingServiceTests content.SetValue("title", null, culture: langDa.IsoCode); ContentService.Save(content); - var result = await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet() { langEn.IsoCode }), Constants.Security.SuperUserKey); + var result = await ContentPublishingService.PublishAsync(content.Key, [new CulturePublishScheduleModel { Culture = langEn.IsoCode }], Constants.Security.SuperUserKey); + Assert.IsTrue(result.Success); Assert.AreEqual(ContentPublishingOperationStatus.Success, result.Status); @@ -320,7 +325,9 @@ public partial class ContentPublishingServiceTests content.SetValue("title", "DA title", culture: langDa.IsoCode); ContentService.Save(content); - var result = await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet() { langEn.IsoCode, langDa.IsoCode }), Constants.Security.SuperUserKey); + var result = await ContentPublishingService.PublishAsync(content.Key, [ + new CulturePublishScheduleModel { Culture = langEn.IsoCode }, + new CulturePublishScheduleModel { Culture = langDa.IsoCode }], Constants.Security.SuperUserKey); Assert.IsTrue(result.Success); Assert.AreEqual(ContentPublishingOperationStatus.Success, result.Status); @@ -355,7 +362,10 @@ public partial class ContentPublishingServiceTests content.SetValue("invariantValue", "Invariant value"); ContentService.Save(content); - var result = await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet { "en-US", "da-DK" }), Constants.Security.SuperUserKey); + var result = await ContentPublishingService.PublishAsync(content.Key, [ + new CulturePublishScheduleModel { Culture = "en-US" }, + new CulturePublishScheduleModel { Culture = "da-DK" }], Constants.Security.SuperUserKey); + Assert.IsTrue(result.Success); content = ContentService.GetById(content.Key)!; @@ -364,7 +374,7 @@ public partial class ContentPublishingServiceTests content.SetValue("invariantValue", null); ContentService.Save(content); - result = await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet(culturesToRepublish)), Constants.Security.SuperUserKey); + result = await ContentPublishingService.PublishAsync(content.Key, culturesToRepublish.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(), Constants.Security.SuperUserKey); content = ContentService.GetById(content.Key)!; @@ -407,7 +417,7 @@ public partial class ContentPublishingServiceTests [Test] public async Task Cannot_Publish_Non_Existing_Content() { - var result = await ContentPublishingService.PublishAsync(Guid.NewGuid(), MakeModel(_allCultures), Constants.Security.SuperUserKey); + var result = await ContentPublishingService.PublishAsync(Guid.NewGuid(), _allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(), Constants.Security.SuperUserKey); Assert.IsFalse(result.Success); Assert.AreEqual(ContentPublishingOperationStatus.ContentNotFound, result.Status); } @@ -426,7 +436,7 @@ public partial class ContentPublishingServiceTests { var content = await CreateInvalidContent(); - var result = await ContentPublishingService.PublishAsync(content.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey); + var result = await ContentPublishingService.PublishAsync(content.Key, _allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(), Constants.Security.SuperUserKey); Assert.IsFalse(result); Assert.AreEqual(ContentPublishingOperationStatus.ContentInvalid, result.Status); @@ -475,7 +485,9 @@ public partial class ContentPublishingServiceTests content.SetValue("title", null, culture: langDa.IsoCode); ContentService.Save(content); - var result = await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet() { langEn.IsoCode, langDa.IsoCode }), Constants.Security.SuperUserKey); + var result = await ContentPublishingService.PublishAsync(content.Key, [ + new CulturePublishScheduleModel { Culture = langEn.IsoCode }, + new CulturePublishScheduleModel { Culture = langDa.IsoCode }], Constants.Security.SuperUserKey); Assert.IsFalse(result.Success); Assert.AreEqual(ContentPublishingOperationStatus.ContentInvalid, result.Status); @@ -497,7 +509,9 @@ public partial class ContentPublishingServiceTests content.SetValue("title", "DA title", culture: langDa.IsoCode); ContentService.Save(content); - var result = await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet() { langDa.IsoCode }), Constants.Security.SuperUserKey); + var result = await ContentPublishingService.PublishAsync(content.Key, [ + new CulturePublishScheduleModel { Culture = langDa.IsoCode }], Constants.Security.SuperUserKey); + Assert.IsFalse(result.Success); Assert.AreEqual(ContentPublishingOperationStatus.MandatoryCultureMissing, result.Status); @@ -545,7 +559,7 @@ public partial class ContentPublishingServiceTests { VerifyIsNotPublished(Textpage.Key); - var result = await ContentPublishingService.PublishAsync(Subpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey); + var result = await ContentPublishingService.PublishAsync(Subpage.Key, [new CulturePublishScheduleModel()], Constants.Security.SuperUserKey); Assert.IsFalse(result.Success); Assert.AreEqual(ContentPublishingOperationStatus.PathNotPublished, result.Status); @@ -558,7 +572,7 @@ public partial class ContentPublishingServiceTests ContentService.MoveToRecycleBin(Subpage); Assert.IsTrue(ContentService.GetById(Subpage.Key)!.Trashed); - var result = await ContentPublishingService.PublishAsync(Subpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey); + var result = await ContentPublishingService.PublishAsync(Subpage.Key, [new CulturePublishScheduleModel()], Constants.Security.SuperUserKey); Assert.IsFalse(result.Success); Assert.AreEqual(ContentPublishingOperationStatus.InTrash, result.Status); @@ -572,7 +586,7 @@ public partial class ContentPublishingServiceTests Textpage.SetValue("author", "This is not a number"); ContentService.Save(Textpage); - var result = await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey); + var result = await ContentPublishingService.PublishAsync(Textpage.Key, [new CulturePublishScheduleModel()], Constants.Security.SuperUserKey); Assert.IsTrue(result.Success); VerifyIsPublished(Textpage.Key); @@ -580,7 +594,7 @@ public partial class ContentPublishingServiceTests ContentType.PropertyTypes.First(pt => pt.Alias == "author").ValidationRegExp = "^\\d*$"; await ContentTypeService.SaveAsync(ContentType, Constants.Security.SuperUserKey); - result = await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey); + result = await ContentPublishingService.PublishAsync(Textpage.Key, [new CulturePublishScheduleModel()], Constants.Security.SuperUserKey); Assert.IsFalse(result.Success); Assert.AreEqual(ContentPublishingOperationStatus.ContentInvalid, result.Status); @@ -596,7 +610,7 @@ public partial class ContentPublishingServiceTests [Test] public async Task Cannot_Republish_Content_After_Adding_Mandatory_Property() { - var result = await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey); + var result = await ContentPublishingService.PublishAsync(Textpage.Key, [new CulturePublishScheduleModel()], Constants.Security.SuperUserKey); Assert.IsTrue(result.Success); VerifyIsPublished(Textpage.Key); @@ -607,7 +621,7 @@ public partial class ContentPublishingServiceTests }); await ContentTypeService.SaveAsync(ContentType, Constants.Security.SuperUserKey); - result = await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey); + result = await ContentPublishingService.PublishAsync(Textpage.Key, [new CulturePublishScheduleModel()], Constants.Security.SuperUserKey); Assert.IsFalse(result.Success); Assert.AreEqual(ContentPublishingOperationStatus.ContentInvalid, result.Status); @@ -684,7 +698,7 @@ public partial class ContentPublishingServiceTests content.SetValue("title", "DA title", culture: langDa.IsoCode); ContentService.Save(content); - var result = await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet() { cultureCode }), Constants.Security.SuperUserKey); + var result = await ContentPublishingService.PublishAsync(content.Key, [new CulturePublishScheduleModel { Culture = cultureCode }], Constants.Security.SuperUserKey); Assert.IsFalse(result.Success); Assert.AreEqual(ContentPublishingOperationStatus.InvalidCulture, result.Status); @@ -705,7 +719,7 @@ public partial class ContentPublishingServiceTests content.SetValue("title", "DA title", culture: langDa.IsoCode); ContentService.Save(content); - var result = await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet() { cultureCode }), Constants.Security.SuperUserKey); + var result = await ContentPublishingService.PublishAsync(content.Key, [new CulturePublishScheduleModel { Culture = cultureCode }], Constants.Security.SuperUserKey); Assert.IsFalse(result.Success); Assert.AreEqual(ContentPublishingOperationStatus.InvalidCulture, result.Status); @@ -714,21 +728,30 @@ public partial class ContentPublishingServiceTests [Test] public async Task Can_Publish_Invariant_Content_With_Cultures_Provided_If_The_Default_Culture_Is_Exclusively_Provided() { - var result = await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(new HashSet() { "en-US" }), Constants.Security.SuperUserKey); + var result = await ContentPublishingService.PublishAsync(Textpage.Key, [new CulturePublishScheduleModel { Culture = "en-US" }], Constants.Security.SuperUserKey); Assert.IsTrue(result.Success); } [Test] public async Task Can_Publish_Invariant_Content_With_Cultures_Provided_If_The_Default_Culture_Is_Provided_With_Other_Cultures() { - var result = await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(new HashSet() { "en-US", "da-DK" }), Constants.Security.SuperUserKey); + var result = await ContentPublishingService.PublishAsync( + Textpage.Key, [ + new CulturePublishScheduleModel { Culture = "en-US" }, + new CulturePublishScheduleModel { Culture = "da-DK" }], + Constants.Security.SuperUserKey); + Assert.IsTrue(result.Success); } [Test] public async Task Cannot_Publish_Invariant_Content_With_Cultures_Provided_That_Do_Not_Include_The_Default_Culture() { - var result = await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(new HashSet() { "da-DK" }), Constants.Security.SuperUserKey); + var result = await ContentPublishingService.PublishAsync( + Textpage.Key, + [new CulturePublishScheduleModel { Culture = "da-DK" }], + Constants.Security.SuperUserKey); + Assert.IsFalse(result.Success); Assert.AreEqual(ContentPublishingOperationStatus.InvalidCulture, result.Status); } diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentPublishingServiceTests.Scheduling.cs b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentPublishingServiceTests.Scheduling.cs index 61c26bc873..35d32a06c4 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentPublishingServiceTests.Scheduling.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentPublishingServiceTests.Scheduling.cs @@ -1,6 +1,6 @@ using NUnit.Framework; using Umbraco.Cms.Core; -using Umbraco.Cms.Core.Models; +using Umbraco.Cms.Core.Models.ContentPublishing; using Umbraco.Cms.Core.Services.OperationStatus; namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Services; @@ -14,7 +14,7 @@ public partial class ContentPublishingServiceTests var result = await ContentPublishingService.PublishAsync( Textpage.Key, - MakeModel(ContentScheduleCollection.CreateWithEntry("*", DateTime.UtcNow.AddDays(1), null)), + _allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture, Schedule = new ContentScheduleModel { PublishDate = DateTimeOffset.Now.AddDays(1) } }).ToArray(), Constants.Security.SuperUserKey); Assert.IsTrue(result.Success); @@ -25,7 +25,10 @@ public partial class ContentPublishingServiceTests [Test] public async Task Publish_Single_Item_Does_Not_Publish_Children_In_The_Future() { - await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(ContentScheduleCollection.CreateWithEntry("*", DateTime.UtcNow.AddDays(1), null)), Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync( + Textpage.Key, + _allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture, Schedule = new ContentScheduleModel { PublishDate = DateTimeOffset.Now.AddDays(1) } }).ToArray(), + Constants.Security.SuperUserKey); VerifyIsNotPublished(Textpage.Key); VerifyIsNotPublished(Subpage.Key); @@ -34,9 +37,15 @@ public partial class ContentPublishingServiceTests [Test] public async Task Can_Publish_Child_Of_Root_In_The_Future() { - await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync( + Textpage.Key, + _allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(), + Constants.Security.SuperUserKey); - var result = await ContentPublishingService.PublishAsync(Subpage.Key, MakeModel(ContentScheduleCollection.CreateWithEntry("*", DateTime.UtcNow.AddDays(1), null)), Constants.Security.SuperUserKey); + var result = await ContentPublishingService.PublishAsync( + Subpage.Key, + _allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture, Schedule = new ContentScheduleModel { PublishDate = DateTimeOffset.Now.AddDays(1) } }).ToArray(), + Constants.Security.SuperUserKey); Assert.IsTrue(result.Success); Assert.AreEqual(ContentPublishingOperationStatus.Success, result.Status); diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentPublishingServiceTests.Unpublish.cs b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentPublishingServiceTests.Unpublish.cs index c292727785..b6bf57936b 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentPublishingServiceTests.Unpublish.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/ContentPublishingServiceTests.Unpublish.cs @@ -3,6 +3,7 @@ using NUnit.Framework; using Umbraco.Cms.Core; using Umbraco.Cms.Core.Configuration.Models; using Umbraco.Cms.Core.Models; +using Umbraco.Cms.Core.Models.ContentPublishing; using Umbraco.Cms.Core.Services; using Umbraco.Cms.Core.Services.OperationStatus; using Umbraco.Cms.Tests.Common.Builders; @@ -20,7 +21,7 @@ public partial class ContentPublishingServiceTests [Test] public async Task Can_Unpublish_Root() { - await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync(Textpage.Key, _allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(), Constants.Security.SuperUserKey); VerifyIsPublished(Textpage.Key); var result = await ContentPublishingService.UnpublishAsync(Textpage.Key, null, Constants.Security.SuperUserKey); @@ -33,8 +34,8 @@ public partial class ContentPublishingServiceTests [Test] public async Task Can_Unpublish_Child() { - await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey); - await ContentPublishingService.PublishAsync(Subpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync(Textpage.Key, _allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(), Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync(Subpage.Key, _allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(), Constants.Security.SuperUserKey); VerifyIsPublished(Textpage.Key); VerifyIsPublished(Subpage.Key); @@ -49,10 +50,10 @@ public partial class ContentPublishingServiceTests [Test] public async Task Can_Unpublish_Structure() { - await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey); - await ContentPublishingService.PublishAsync(Subpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey); - await ContentPublishingService.PublishAsync(Subpage2.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey); - await ContentPublishingService.PublishAsync(Subpage3.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync(Textpage.Key, _allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(), Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync(Subpage.Key, _allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(), Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync(Subpage2.Key, _allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(), Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync(Subpage3.Key, _allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(), Constants.Security.SuperUserKey); VerifyIsPublished(Textpage.Key); VerifyIsPublished(Subpage.Key); VerifyIsPublished(Subpage2.Key); @@ -88,7 +89,7 @@ public partial class ContentPublishingServiceTests [Test] public async Task Can_Cancel_Unpublishing_With_Notification() { - await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync(Textpage.Key, _allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(), Constants.Security.SuperUserKey); VerifyIsPublished(Textpage.Key); ContentNotificationHandler.UnpublishingContent = notification => notification.Cancel = true; @@ -104,7 +105,7 @@ public partial class ContentPublishingServiceTests [ConfigureBuilder(ActionName = nameof(ConfigureDisableUnpublishWhenReferencedTrue))] public async Task Cannot_Unpublish_When_Content_Is_Related_As_A_Child_And_Configured_To_Disable_When_Related() { - await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync(Textpage.Key, _allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(), Constants.Security.SuperUserKey); VerifyIsPublished(Textpage.Key); // Setup a relation where the page being unpublished is related to another page as a child (e.g. the other page has a picker and has selected this page). @@ -121,7 +122,7 @@ public partial class ContentPublishingServiceTests [ConfigureBuilder(ActionName = nameof(ConfigureDisableUnpublishWhenReferencedTrue))] public async Task Can_Unpublish_When_Content_Is_Related_As_A_Parent_And_Configured_To_Disable_When_Related() { - await ContentPublishingService.PublishAsync(Textpage.Key, MakeModel(_allCultures), Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync(Textpage.Key, _allCultures.Select(culture => new CulturePublishScheduleModel { Culture = culture }).ToArray(), Constants.Security.SuperUserKey); VerifyIsPublished(Textpage.Key); // Setup a relation where the page being unpublished is related to another page as a parent (e.g. this page has a picker and has selected the other page). @@ -147,7 +148,9 @@ public partial class ContentPublishingServiceTests content.SetValue("title", "EN title", culture: langEn.IsoCode); content.SetValue("title", "DA title", culture: langDa.IsoCode); ContentService.Save(content); - await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet() { langEn.IsoCode, langDa.IsoCode }), Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync(content.Key, [ + new CulturePublishScheduleModel { Culture = langEn.IsoCode }, + new CulturePublishScheduleModel { Culture = langDa.IsoCode }], Constants.Security.SuperUserKey); VerifyIsPublished(content.Key); var result = await ContentPublishingService.UnpublishAsync(content.Key, new HashSet { langEn.IsoCode }, Constants.Security.SuperUserKey); @@ -173,7 +176,9 @@ public partial class ContentPublishingServiceTests content.SetValue("title", "EN title", culture: langEn.IsoCode); content.SetValue("title", "DA title", culture: langDa.IsoCode); ContentService.Save(content); - await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet() { langEn.IsoCode, langDa.IsoCode }), Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync(content.Key, [ + new CulturePublishScheduleModel { Culture = langEn.IsoCode }, + new CulturePublishScheduleModel { Culture = langDa.IsoCode }], Constants.Security.SuperUserKey); VerifyIsPublished(content.Key); var result = await ContentPublishingService.UnpublishAsync(content.Key, new HashSet(){"*"}, Constants.Security.SuperUserKey); @@ -198,7 +203,9 @@ public partial class ContentPublishingServiceTests content.SetValue("title", "EN title", culture: langEn.IsoCode); content.SetValue("title", "DA title", culture: langDa.IsoCode); ContentService.Save(content); - await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet() { langEn.IsoCode, langDa.IsoCode }), Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync(content.Key, [ + new CulturePublishScheduleModel { Culture = langEn.IsoCode }, + new CulturePublishScheduleModel { Culture = langDa.IsoCode }], Constants.Security.SuperUserKey); VerifyIsPublished(content.Key); var result = await ContentPublishingService.UnpublishAsync(content.Key, new HashSet() { langEn.IsoCode, langDa.IsoCode }, Constants.Security.SuperUserKey); @@ -230,7 +237,15 @@ public partial class ContentPublishingServiceTests content.SetValue("title", "DA title", culture: langDa.IsoCode); content.SetValue("title", "SE title", culture: langSe.IsoCode); ContentService.Save(content); - await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet() { langEn.IsoCode, langDa.IsoCode, langSe.IsoCode }), Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync( + content.Key, + [ + new CulturePublishScheduleModel { Culture = langEn.IsoCode }, + new CulturePublishScheduleModel { Culture = langDa.IsoCode }, + new CulturePublishScheduleModel { Culture = langSe.IsoCode } + ], + Constants.Security.SuperUserKey); + VerifyIsPublished(content.Key); content = ContentService.GetById(content.Key)!; Assert.AreEqual(3, content.PublishedCultures.Count()); @@ -256,7 +271,14 @@ public partial class ContentPublishingServiceTests content.SetValue("title", "EN title", culture: langEn.IsoCode); content.SetValue("title", "DA title", culture: langDa.IsoCode); ContentService.Save(content); - await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet() { langEn.IsoCode, langDa.IsoCode }), Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync( + content.Key, + [ + new CulturePublishScheduleModel { Culture = langEn.IsoCode }, + new CulturePublishScheduleModel { Culture = langDa.IsoCode } + ], + Constants.Security.SuperUserKey); + VerifyIsPublished(content.Key); content = ContentService.GetById(content.Key)!; @@ -284,7 +306,9 @@ public partial class ContentPublishingServiceTests content.SetValue("title", "EN title", culture: langEn.IsoCode); content.SetValue("title", "DA title", culture: langDa.IsoCode); ContentService.Save(content); - await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet() { langEn.IsoCode, langDa.IsoCode }), Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync(content.Key, [ + new CulturePublishScheduleModel { Culture = langEn.IsoCode }, + new CulturePublishScheduleModel { Culture = langDa.IsoCode }], Constants.Security.SuperUserKey); VerifyIsPublished(content.Key); content = ContentService.GetById(content.Key)!; @@ -326,7 +350,9 @@ public partial class ContentPublishingServiceTests content.SetValue("title", "EN title", culture: langEn.IsoCode); content.SetValue("title", "DA title", culture: langDa.IsoCode); ContentService.Save(content); - await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet() { langEn.IsoCode, langDa.IsoCode }), Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync(content.Key, [ + new CulturePublishScheduleModel { Culture = langEn.IsoCode }, + new CulturePublishScheduleModel { Culture = langDa.IsoCode }], Constants.Security.SuperUserKey); VerifyIsPublished(content.Key); var result = await ContentPublishingService.UnpublishAsync(content.Key, new HashSet() { cultureCode }, Constants.Security.SuperUserKey); @@ -352,7 +378,11 @@ public partial class ContentPublishingServiceTests content.SetValue("title", "EN title", culture: langEn.IsoCode); content.SetValue("title", "DA title", culture: langDa.IsoCode); ContentService.Save(content); - await ContentPublishingService.PublishAsync(content.Key, MakeModel(new HashSet() { langEn.IsoCode, langDa.IsoCode }), Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync(content.Key, [ + new CulturePublishScheduleModel { Culture = langEn.IsoCode }, + new CulturePublishScheduleModel { Culture = langDa.IsoCode } + ], Constants.Security.SuperUserKey); + VerifyIsPublished(content.Key); var result = await ContentPublishingService.UnpublishAsync(content.Key, new HashSet() { cultureCode }, Constants.Security.SuperUserKey); diff --git a/tests/Umbraco.Tests.Integration/Umbraco.PublishedCache.HybridCache/DocumentHybridCacheAncestryTests.cs b/tests/Umbraco.Tests.Integration/Umbraco.PublishedCache.HybridCache/DocumentHybridCacheAncestryTests.cs index 2bead8722a..8e831375e8 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.PublishedCache.HybridCache/DocumentHybridCacheAncestryTests.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.PublishedCache.HybridCache/DocumentHybridCacheAncestryTests.cs @@ -48,7 +48,7 @@ internal sealed class DocumentHybridCacheAncestryTests : UmbracoIntegrationTestW // Text Page // Sub Page <-- Unpublished // Sub Sub Page - await ContentPublishingService.PublishBranchAsync(Textpage.Key, Array.Empty(), true, Constants.Security.SuperUserKey); + await ContentPublishingService.PublishBranchAsync(Textpage.Key, Array.Empty(), PublishBranchFilter.All, Constants.Security.SuperUserKey, false); await ContentPublishingService.UnpublishAsync(Subpage.Key, null, Constants.Security.SuperUserKey); var published = await PublishedContentCache.GetByIdAsync(SubSubPage.Key); @@ -58,7 +58,7 @@ internal sealed class DocumentHybridCacheAncestryTests : UmbracoIntegrationTestW [Test] public async Task CanGetPublishedContentIfParentIsPublished() { - await ContentPublishingService.PublishBranchAsync(Textpage.Key, Array.Empty(), true, Constants.Security.SuperUserKey); + await ContentPublishingService.PublishBranchAsync(Textpage.Key, Array.Empty(), PublishBranchFilter.All, Constants.Security.SuperUserKey, false); var published = await PublishedContentCache.GetByIdAsync(SubSubPage.Key); CacheTestsHelper.AssertPage(SubSubPage, published); @@ -70,7 +70,7 @@ internal sealed class DocumentHybridCacheAncestryTests : UmbracoIntegrationTestW // Text Page // Sub Page <-- Unpublished // Sub Sub Page - await ContentPublishingService.PublishBranchAsync(Textpage.Key, Array.Empty(), true, Constants.Security.SuperUserKey); + await ContentPublishingService.PublishBranchAsync(Textpage.Key, Array.Empty(), PublishBranchFilter.Default, Constants.Security.SuperUserKey, false); await ContentPublishingService.UnpublishAsync(Subpage.Key, null, Constants.Security.SuperUserKey); // Clear cache also seeds, but we have to reset the seed keys first since these are cached from test startup diff --git a/tests/Umbraco.Tests.Integration/Umbraco.PublishedCache.HybridCache/DocumentHybridCacheAncestryVariantTests.cs b/tests/Umbraco.Tests.Integration/Umbraco.PublishedCache.HybridCache/DocumentHybridCacheAncestryVariantTests.cs index ac6122a054..e76e6168a0 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.PublishedCache.HybridCache/DocumentHybridCacheAncestryVariantTests.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.PublishedCache.HybridCache/DocumentHybridCacheAncestryVariantTests.cs @@ -57,7 +57,7 @@ internal sealed class DocumentHybridCacheAncestryVariantTests : UmbracoIntegrati public async Task AllCulturesUnpublished(bool preview) { // Publish branch in all cultures - var publishAttempt = await ContentPublishingService.PublishBranchAsync(rootContent.Key, [_englishIsoCode, _danishIsoCode], true, Constants.Security.SuperUserKey); + var publishAttempt = await ContentPublishingService.PublishBranchAsync(rootContent.Key, [_englishIsoCode, _danishIsoCode], PublishBranchFilter.IncludeUnpublished, Constants.Security.SuperUserKey, false); Assert.IsTrue(publishAttempt.Success); Assert.That(publishAttempt.Result.SucceededItems.Count(), Is.EqualTo(3)); @@ -80,7 +80,7 @@ internal sealed class DocumentHybridCacheAncestryVariantTests : UmbracoIntegrati [Test] public async Task SingleCultureUnpublished() { - var publishAttempt = await ContentPublishingService.PublishBranchAsync(rootContent.Key, [_englishIsoCode, _danishIsoCode], true, Constants.Security.SuperUserKey); + var publishAttempt = await ContentPublishingService.PublishBranchAsync(rootContent.Key, [_englishIsoCode, _danishIsoCode], PublishBranchFilter.All, Constants.Security.SuperUserKey, false); Assert.IsTrue(publishAttempt.Success); Assert.That(publishAttempt.Result.SucceededItems.Count(), Is.EqualTo(3)); diff --git a/tests/Umbraco.Tests.Integration/Umbraco.PublishedCache.HybridCache/DocumentHybridCachePropertyTest.cs b/tests/Umbraco.Tests.Integration/Umbraco.PublishedCache.HybridCache/DocumentHybridCachePropertyTest.cs index dc5c7c99fe..5c62df3ded 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.PublishedCache.HybridCache/DocumentHybridCachePropertyTest.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.PublishedCache.HybridCache/DocumentHybridCachePropertyTest.cs @@ -89,11 +89,7 @@ internal sealed class DocumentHybridCachePropertyTest : UmbracoIntegrationTest var publishResult = await ContentPublishingService.PublishAsync( updateResult.Result.Content!.Key, - new CultureAndScheduleModel() - { - CulturesToPublishImmediately = new HashSet { "*" }, - Schedules = new ContentScheduleCollection(), - }, + [new CulturePublishScheduleModel { Culture = "*" }], Constants.Security.SuperUserKey); Assert.IsTrue(publishResult); @@ -123,11 +119,7 @@ internal sealed class DocumentHybridCachePropertyTest : UmbracoIntegrationTest var publishResult = await ContentPublishingService.PublishAsync( result.Result.Content!.Key, - new CultureAndScheduleModel() - { - CulturesToPublishImmediately = new HashSet { "*" }, - Schedules = new ContentScheduleCollection(), - }, + [new CulturePublishScheduleModel { Culture = "*" }], Constants.Security.SuperUserKey); Assert.IsTrue(publishResult.Success); @@ -148,11 +140,7 @@ internal sealed class DocumentHybridCachePropertyTest : UmbracoIntegrationTest var publishResult = await ContentPublishingService.PublishAsync( createResult.Result.Content!.Key, - new CultureAndScheduleModel() - { - CulturesToPublishImmediately = new HashSet { "*" }, - Schedules = new ContentScheduleCollection(), - }, + [new CulturePublishScheduleModel { Culture = "*" }], Constants.Security.SuperUserKey); Assert.IsTrue(publishResult.Success); diff --git a/tests/Umbraco.Tests.Integration/Umbraco.PublishedCache.HybridCache/DocumentHybridCacheScopeTests.cs b/tests/Umbraco.Tests.Integration/Umbraco.PublishedCache.HybridCache/DocumentHybridCacheScopeTests.cs index 6b143e9ce8..5ab8aeeb46 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.PublishedCache.HybridCache/DocumentHybridCacheScopeTests.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.PublishedCache.HybridCache/DocumentHybridCacheScopeTests.cs @@ -34,7 +34,10 @@ internal sealed class DocumentHybridCacheScopeTests : UmbracoIntegrationTestWith { using (CoreScopeProvider.CreateCoreScope()) { - await ContentPublishingService.PublishAsync(Textpage.Key.Value, CultureAndSchedule, Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync( + Textpage.Key.Value, + [new CulturePublishScheduleModel { Culture = "*" }], + Constants.Security.SuperUserKey); } // Act @@ -49,7 +52,9 @@ internal sealed class DocumentHybridCacheScopeTests : UmbracoIntegrationTestWith { using (CoreScopeProvider.CreateCoreScope()) { - await ContentPublishingService.PublishAsync(Textpage.Key.Value, CultureAndSchedule, Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync(Textpage.Key.Value, + [new CulturePublishScheduleModel { Culture = "*" }], + Constants.Security.SuperUserKey); } // Act @@ -64,7 +69,10 @@ internal sealed class DocumentHybridCacheScopeTests : UmbracoIntegrationTestWith { using (var scope = CoreScopeProvider.CreateCoreScope()) { - await ContentPublishingService.PublishAsync(Textpage.Key.Value, CultureAndSchedule, Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync( + Textpage.Key.Value, + [new CulturePublishScheduleModel { Culture = "*" }], + Constants.Security.SuperUserKey); scope.Complete(); } @@ -80,7 +88,10 @@ internal sealed class DocumentHybridCacheScopeTests : UmbracoIntegrationTestWith { using (var scope = CoreScopeProvider.CreateCoreScope()) { - await ContentPublishingService.PublishAsync(Textpage.Key.Value, CultureAndSchedule, Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync( + Textpage.Key.Value, + [new CulturePublishScheduleModel { Culture = "*" }], + Constants.Security.SuperUserKey); scope.Complete(); } diff --git a/tests/Umbraco.Tests.Integration/Umbraco.PublishedCache.HybridCache/DocumentHybridCacheTests.cs b/tests/Umbraco.Tests.Integration/Umbraco.PublishedCache.HybridCache/DocumentHybridCacheTests.cs index 0c4207331a..1aec16e4a0 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.PublishedCache.HybridCache/DocumentHybridCacheTests.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.PublishedCache.HybridCache/DocumentHybridCacheTests.cs @@ -2,6 +2,7 @@ using NUnit.Framework; using Umbraco.Cms.Core; using Umbraco.Cms.Core.Cache; using Umbraco.Cms.Core.Models.ContentEditing; +using Umbraco.Cms.Core.Models.ContentPublishing; using Umbraco.Cms.Core.Models.PublishedContent; using Umbraco.Cms.Core.Notifications; using Umbraco.Cms.Core.PublishedCache; @@ -323,7 +324,10 @@ internal sealed class DocumentHybridCacheTests : UmbracoIntegrationTestWithConte TemplateKey = PublishedTextPage.TemplateKey, }; await ContentEditingService.UpdateAsync(PublishedTextPage.Key.Value, updateModel, Constants.Security.SuperUserKey); - await ContentPublishingService.PublishAsync(PublishedTextPage.Key.Value, CultureAndSchedule, Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync( + PublishedTextPage.Key.Value, + [new CulturePublishScheduleModel { Culture = "*" }], + Constants.Security.SuperUserKey); // Act var textPage = await PublishedContentHybridCache.GetByIdAsync(PublishedTextPage.Key.Value, true); @@ -344,7 +348,10 @@ internal sealed class DocumentHybridCacheTests : UmbracoIntegrationTestWithConte TemplateKey = PublishedTextPage.TemplateKey, }; await ContentEditingService.UpdateAsync(PublishedTextPage.Key.Value, updateModel, Constants.Security.SuperUserKey); - await ContentPublishingService.PublishAsync(PublishedTextPage.Key.Value, CultureAndSchedule, Constants.Security.SuperUserKey); + await ContentPublishingService.PublishAsync( + PublishedTextPage.Key.Value, + [new CulturePublishScheduleModel { Culture = "*" }], + Constants.Security.SuperUserKey); // Act var textPage = await PublishedContentHybridCache.GetByIdAsync(PublishedTextPage.Key.Value);