* Serverside generated preview URLs * Add URL provider notation to UrlInfo * Change preview URL generation to happen at preview time based on provider alias * Update XML docs * Always add culture (if available) to preview URL * Do not log user input (security vulnerability) * Fix typo * Re-generate TypeScript client from Management API * Deprecated `UmbDocumentPreviewRepository.enter()` (for v19) Fixed TS errors Added temp stub for `getPreviewUrl` * Adds `previewOption` extension-type * Adds "default" `previewOption` kind * Relocated "Save and Preview" workspace action reworked using the "default" `previewOption` kind. * Added stub for "urlProvider" `previewOption` kind * Renamed "workspace-action-default-kind.element.ts" to a more suitable filename. Exported element so can be reused in other packages, e.g. documents, for the new "save and preview" feature. * Refactored "Save and Preview" button to work with first action's manifest/API. * Reverted `previewOption` extension-type Re-engineered to make a "urlProvider" kind for `workspaceActionMenuItem`. This is to simplify the extension point and surrounding logic. * Modified `saveAndPreview` Document Workspace Context to accept a URL Provider Alias. * Refactored "Save and Preview" button to extend `UmbWorkspaceActionElement`. This did mean exposing certain methods/properties to be overridable. * Used `umbPeekError` to surface any errors to the user * Renamed `urlProvider` kind to `previewOption` * Relocated `urlProviderAlias` inside the `meta` property * also throw an error * Added missing `await` * Fix build errors after forward merge --------- Co-authored-by: leekelleher <leekelleher@gmail.com> Co-authored-by: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Co-authored-by: Laura Neto <12862535+lauraneto@users.noreply.github.com>
47 lines
2.3 KiB
C#
47 lines
2.3 KiB
C#
using NUnit.Framework;
|
|
using Umbraco.Cms.Core;
|
|
using Umbraco.Cms.Core.Models;
|
|
using Umbraco.Cms.Tests.Common.Builders;
|
|
|
|
namespace Umbraco.Cms.Tests.Integration.Umbraco.Core.Services;
|
|
|
|
internal sealed class PublishedUrlInfoProviderTests : PublishedUrlInfoProviderTestsBase
|
|
{
|
|
|
|
[Test]
|
|
public async Task Two_items_in_level_1_with_same_name_will_have_conflicting_routes()
|
|
{
|
|
// Create a second root
|
|
var secondRoot = ContentBuilder.CreateSimpleContent(ContentType, "Second Root", null);
|
|
var contentSchedule = ContentScheduleCollection.CreateWithEntry(DateTime.UtcNow.AddMinutes(-5), null);
|
|
ContentService.Save(secondRoot, -1, contentSchedule);
|
|
|
|
// Create a child of second root
|
|
var childOfSecondRoot = ContentBuilder.CreateSimpleContent(ContentType, Subpage.Name, secondRoot);
|
|
childOfSecondRoot.Key = new Guid("FF6654FB-BC68-4A65-8C6C-135567F50BD6");
|
|
ContentService.Save(childOfSecondRoot, -1, contentSchedule);
|
|
|
|
// Publish both the main root and the second root with descendants
|
|
ContentService.PublishBranch(Textpage, PublishBranchFilter.IncludeUnpublished, ["*"]);
|
|
ContentService.PublishBranch(secondRoot, PublishBranchFilter.IncludeUnpublished, ["*"]);
|
|
|
|
var subPageUrls = await PublishedUrlInfoProvider.GetAllAsync(Subpage);
|
|
var childOfSecondRootUrls = await PublishedUrlInfoProvider.GetAllAsync(childOfSecondRoot);
|
|
|
|
// Assert the url of subpage is correct
|
|
Assert.AreEqual(1, subPageUrls.Count);
|
|
Assert.IsNotNull(subPageUrls.First().Url);
|
|
Assert.AreEqual("/text-page-1/", subPageUrls.First().Url!.ToString());
|
|
Assert.AreEqual(Constants.UrlProviders.Content, subPageUrls.First().Provider);
|
|
Assert.AreEqual(Subpage.Key, DocumentUrlService.GetDocumentKeyByRoute("/text-page-1/", "en-US", null, false));
|
|
|
|
// Assert the url of child of second root is not exposed
|
|
Assert.AreEqual(1, childOfSecondRootUrls.Count);
|
|
Assert.IsNull(childOfSecondRootUrls.First().Url);
|
|
Assert.AreEqual(Constants.UrlProviders.Content, childOfSecondRootUrls.First().Provider);
|
|
|
|
// Ensure the url without hide top level is not finding the child of second root
|
|
Assert.AreNotEqual(childOfSecondRoot.Key, DocumentUrlService.GetDocumentKeyByRoute("/second-root/text-page-1/", "en-US", null, false));
|
|
}
|
|
}
|