diff --git a/src/Umbraco.Core/Services/ContentService.cs b/src/Umbraco.Core/Services/ContentService.cs index b0bdbc6edc..3ae1546aa2 100644 --- a/src/Umbraco.Core/Services/ContentService.cs +++ b/src/Umbraco.Core/Services/ContentService.cs @@ -35,7 +35,6 @@ public class ContentService : RepositoryService, IContentService private readonly ILogger _logger; private readonly IUserIdKeyResolver _userIdKeyResolver; private readonly IIdKeyMap _idKeyMap; - private IQuery? _queryNotTrashed; private readonly Lazy _crudServiceLazy; // Property for convenient access (deferred resolution for both paths) @@ -128,14 +127,6 @@ public class ContentService : RepositoryService, IContentService } - #endregion - - #region Static queries - - // lazy-constructed because when the ctor runs, the query factory may not be ready - private IQuery QueryNotTrashed => - _queryNotTrashed ??= Query().Where(x => x.Trashed == false); - #endregion #region Rollback @@ -451,19 +442,6 @@ public class ContentService : RepositoryService, IContentService public IEnumerable GetRootContent() => CrudService.GetRootContent(); - /// - /// Gets all published content items - /// - /// - internal IEnumerable GetAllPublished() - { - using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true)) - { - scope.ReadLock(Constants.Locks.ContentTree); - return _documentRepository.Get(QueryNotTrashed); - } - } - /// public IEnumerable GetContentForExpiration(DateTime date) => PublishOperationService.GetContentForExpiration(date); @@ -691,13 +669,6 @@ public class ContentService : RepositoryService, IContentService public IContent? Copy(IContent content, int parentId, bool relateToOriginal, bool recursive, int userId = Constants.Security.SuperUserId) => MoveOperationService.Copy(content, parentId, relateToOriginal, recursive, userId); - private bool TryGetParentKey(int parentId, [NotNullWhen(true)] out Guid? parentKey) - { - Attempt parentKeyAttempt = _idKeyMap.GetKeyForId(parentId, UmbracoObjectTypes.Document); - parentKey = parentKeyAttempt.Success ? parentKeyAttempt.Result : null; - return parentKeyAttempt.Success; - } - /// public bool SendToPublication(IContent? content, int userId = Constants.Security.SuperUserId) => PublishOperationService.SendToPublication(content, userId); @@ -730,8 +701,6 @@ public class ContentService : RepositoryService, IContentService public OperationResult Sort(IEnumerable? ids, int userId = Constants.Security.SuperUserId) => MoveOperationService.Sort(ids, userId); - private static bool HasUnsavedChanges(IContent content) => content.HasIdentity is false || content.IsDirty(); - public ContentDataIntegrityReport CheckDataIntegrity(ContentDataIntegrityReportOptions options) => CrudService.CheckDataIntegrity(options); diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Examine/DeliveryApiContentIndexHelperTests.cs b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Examine/DeliveryApiContentIndexHelperTests.cs index dc16d1ae16..a4bd5dbb9b 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Examine/DeliveryApiContentIndexHelperTests.cs +++ b/tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Examine/DeliveryApiContentIndexHelperTests.cs @@ -113,8 +113,11 @@ public class DeliveryApiContentIndexHelperTests : UmbracoIntegrationTestWithCont private int GetExpectedNumberOfContentItems() { - var result = ContentService.GetAllPublished().Count(); - Assert.AreEqual(10, result); - return result; + // Count all non-trashed content items - matching the behavior of the old GetAllPublished method + // which was actually getting all non-trashed content, not just published content + var allContent = ContentService.GetPagedDescendants(Cms.Core.Constants.System.Root, 0, int.MaxValue, out var total); + var nonTrashedCount = allContent.Count(c => !c.Trashed); + Assert.AreEqual(10, nonTrashedCount); + return nonTrashedCount; } }