Determine urls at save and publish time (#17033)
* Started work on service * temp work * temp commit * Temp commit * Added more routing logic * Fixed tests * Refactor and prepare for isdraft * Work on drafts * Fixed tests * Move to enlistment to ensure caches is only updated on scope complete * Clean up and handle null cultures * Added functionality to the INavigationQueryService to get root keys * Added migration * Fixed issue with navigation * Added migration * Temp commit, move to cache refreshers. * Fixed issues * List urls * fix build * Fixed integration tests * Refactor to create new content finder instead of changing the old * rollback wrong commited line * Clean up, and use docuemnt url service for index * Fixed List endpoin * Do not use Navigation service in methods intended by management api * Fixed examine tests * Make methods virtual * Use domain from published request * Use hybrid cache from new content finder * Eliminate nucache usage * Fixed issue with delivery api and url generation * Fixed linux tests * Added hybrid cache to all integration tests
This commit is contained in:
@@ -17,8 +17,9 @@ public static class ContentBaseExtensions
|
||||
/// <param name="shortStringHelper"></param>
|
||||
/// <param name="urlSegmentProviders"></param>
|
||||
/// <param name="culture">The culture.</param>
|
||||
/// <param name="published">Whether to get the published or draft.</param>
|
||||
/// <returns>The URL segment.</returns>
|
||||
public static string? GetUrlSegment(this IContentBase content, IShortStringHelper shortStringHelper, IEnumerable<IUrlSegmentProvider> urlSegmentProviders, string? culture = null)
|
||||
public static string? GetUrlSegment(this IContentBase content, IShortStringHelper shortStringHelper, IEnumerable<IUrlSegmentProvider> urlSegmentProviders, string? culture = null, bool published = true)
|
||||
{
|
||||
if (content == null)
|
||||
{
|
||||
@@ -30,7 +31,7 @@ public static class ContentBaseExtensions
|
||||
throw new ArgumentNullException(nameof(urlSegmentProviders));
|
||||
}
|
||||
|
||||
var url = urlSegmentProviders.Select(p => p.GetUrlSegment(content, culture)).FirstOrDefault(u => u != null);
|
||||
var url = urlSegmentProviders.Select(p => p.GetUrlSegment(content, published, culture)).FirstOrDefault(u => u != null);
|
||||
if (url == null)
|
||||
{
|
||||
if (_defaultUrlSegmentProvider == null)
|
||||
|
||||
@@ -296,7 +296,12 @@ public static class ContentRepositoryExtensions
|
||||
/// A value indicating whether it was possible to publish the names and values for the specified
|
||||
/// culture(s). The method may fail if required names are not set, but it does NOT validate property data
|
||||
/// </returns>
|
||||
///
|
||||
public static bool PublishCulture(this IContent content, CultureImpact? impact)
|
||||
{
|
||||
return PublishCulture(content, impact, DateTime.Now);
|
||||
}
|
||||
public static bool PublishCulture(this IContent content, CultureImpact? impact, DateTime publishTime)
|
||||
{
|
||||
if (impact == null)
|
||||
{
|
||||
@@ -323,7 +328,7 @@ public static class ContentRepositoryExtensions
|
||||
return false;
|
||||
}
|
||||
|
||||
content.SetPublishInfo(culture, name, DateTime.Now);
|
||||
content.SetPublishInfo(culture, name, publishTime);
|
||||
}
|
||||
}
|
||||
else if (impact.ImpactsOnlyInvariantCulture)
|
||||
@@ -342,7 +347,7 @@ public static class ContentRepositoryExtensions
|
||||
return false;
|
||||
}
|
||||
|
||||
content.SetPublishInfo(impact.Culture, name, DateTime.Now);
|
||||
content.SetPublishInfo(impact.Culture, name, publishTime);
|
||||
}
|
||||
|
||||
// set values
|
||||
|
||||
9
src/Umbraco.Core/Models/PublishedDocumentUrlSegment.cs
Normal file
9
src/Umbraco.Core/Models/PublishedDocumentUrlSegment.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace Umbraco.Cms.Core.Models;
|
||||
|
||||
public class PublishedDocumentUrlSegment
|
||||
{
|
||||
public required Guid DocumentKey { get; set; }
|
||||
public required int LanguageId { get; set; }
|
||||
public required string UrlSegment { get; set; }
|
||||
public required bool IsDraft { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user