Introduced sign providers for trees and implemented one for documents with schedule pending (#19806)
* Create sign provider collection and call registered providers on rendering a page of tree item view models. Re-work tree controller constructors to provide registered providers as a collection. * Stub implementation of sign provider for documents with a scheduled publish pending. * Complete implementation of tree sign for pending scheduled publish. * Added integration test for new method on IContentService. * Added unit test for HasScheduleSignProvider. * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Tidied usings and clarified method header comments. * Adding a fixed prefix to all future signs, and removing the provider property * Adding a sign for protected tree documents. * Adding IsProtectedSignProviderTest.cs & correcting HasScheduleSignProviderTests.cs to no longer assert the provider * Fixing minor things in accordance with CR * Adding collection items compatibility * Introduced IHasSigns interface to provide more re-use across trees and collections. Fixed updates to base content controllers (no need to introduce a new type variable). Removed passing entities for populating tree signs (we aren't using it, so simplifies things). * Refactoring a bit to make existing code less duplicated and fixing some constructor obsoletion * Introducing a has pending changes sign. * Applying changes based on CR * Introducing tests for HasPendingChangesSignProvider.cs and stopped the use of contentService * Introducing tests for HasPendingChangesSignProvider.cs and slight logic change * Introduced HasCollectionSignProvider.cs and tests. * Introducing collection signs to Media Tree & Media Collection items * Introducing Plain Items and tests. Refactoring tests as well * Introduced alternative CanProvideSigns() implementation on IsProtectedSignProvider.cs * Slight refactoring to reduce bloating. * Adding [ActivatorUtilitiesConstructor] since it threw an error otherwise * Minor cleanup. * Updated OpenApi.json. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: NillasKA <kramernicklas@gmail.com>
This commit is contained in:
@@ -687,6 +687,25 @@ internal sealed class ContentServiceTests : UmbracoIntegrationTestWithContent
|
||||
Assert.That(contents.Count(), Is.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Can_Get_Scheduled_Content_Keys()
|
||||
{
|
||||
// Arrange
|
||||
var root = ContentService.GetById(Textpage.Id);
|
||||
ContentService.Publish(root!, root!.AvailableCultures.ToArray());
|
||||
var content = ContentService.GetById(Subpage.Id);
|
||||
var contentSchedule = ContentScheduleCollection.CreateWithEntry(DateTime.UtcNow.AddDays(1), null);
|
||||
ContentService.PersistContentSchedule(content!, contentSchedule);
|
||||
ContentService.Publish(content, content.AvailableCultures.ToArray());
|
||||
|
||||
// Act
|
||||
var keys = ContentService.GetScheduledContentKeys([Textpage.Key, Subpage.Key, Subpage2.Key]).ToList();
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(1, keys.Count);
|
||||
Assert.AreEqual(Subpage.Key, keys.First());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Can_Get_Content_For_Release()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user