V17 - Properties and validators, removing obsoleted code (#19961)
* Removing obsoleted code from ApiMediaQueryService.cs * Removing obsoleted code from ApiRichTextMarkupParserTests.cs * Removing obsoleted code from ContentCacheRefresher.cs * Removing obsoleted code from ContentFinderByUrlAlias.cs and adjusting its tests to use the new logic * Removing obsoleted code from ContentFinderByUrl.cs & its dependencies * Removing obsoleted code from ApiRichTextMarkupParserTests.cs * Removing obsoleted code from DocumentCache.cs & its dependencies * Removing obsoleted code from MediaCache.cs & its dependencies * Removing obsoleted code from PublishedCacheBase.cs & its dependencies * Removing obsoleted code from RenderNoContentController.cs and its tests * Removing obsoleted code from UmbracoRouteValueTransformer.cs * Removing obsoleted constructors from DefaultUrlProvider.cs * Removing the RadioValueEditor.cs & RadioValueValidator.cs obsoleted classes. * Removing obsolete constructor from MultipleValueValidator.cs * Removing obsolete constructor from EmailValidator.cs * Removing obsoleted code from DataValueReferenceFactoryCollection.cs * Removing obsoleted code from ApiContentBuilderBase.cs * Fixing constructor missing attribute * Making use of the TryGet result * Fixing use of obsoleted constructor * Removing silly bookmark comment * Fixing deleted code and restructuring to use new cache * Making use of TryGetRootKeys bool, to return null if false. * Extending code to use new constructor * Updated PublishedContentQuery.cs to return empty array Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com> --------- Co-authored-by: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com>
This commit is contained in:
@@ -43,30 +43,6 @@ public sealed class DocumentCache : IPublishedContentCache
|
||||
|
||||
public IPublishedContent? GetById(Guid contentId) => GetByIdAsync(contentId).GetAwaiter().GetResult();
|
||||
|
||||
// TODO: These are all obsolete and should be removed
|
||||
|
||||
[Obsolete("Scheduled for removal in v17")]
|
||||
public IPublishedContent? GetById(bool preview, Udi contentId)
|
||||
{
|
||||
if(contentId is not GuidUdi guidUdi)
|
||||
{
|
||||
throw new NotSupportedException("Only GuidUdi is supported");
|
||||
}
|
||||
|
||||
return GetById(preview, guidUdi.Guid);
|
||||
}
|
||||
|
||||
[Obsolete("Scheduled for removal in v17")]
|
||||
public IPublishedContent? GetById(Udi contentId)
|
||||
{
|
||||
if(contentId is not GuidUdi guidUdi)
|
||||
{
|
||||
throw new NotSupportedException("Only GuidUdi is supported");
|
||||
}
|
||||
|
||||
return GetById(guidUdi.Guid);
|
||||
}
|
||||
|
||||
public IEnumerable<IPublishedContent> GetAtRoot(bool preview, string? culture = null)
|
||||
{
|
||||
_documentNavigationQueryService.TryGetRootKeys(out IEnumerable<Guid> rootKeys);
|
||||
@@ -75,34 +51,6 @@ public sealed class DocumentCache : IPublishedContentCache
|
||||
return culture is null ? rootContent : rootContent.Where(x => x.IsInvariantOrHasCulture(culture));
|
||||
}
|
||||
|
||||
public IEnumerable<IPublishedContent> GetAtRoot(string? culture = null)
|
||||
{
|
||||
_documentNavigationQueryService.TryGetRootKeys(out IEnumerable<Guid> rootKeys);
|
||||
|
||||
IEnumerable<IPublishedContent> rootContent = rootKeys.Select(key => GetById(key)).WhereNotNull();
|
||||
return culture is null ? rootContent : rootContent.Where(x => x.IsInvariantOrHasCulture(culture));
|
||||
}
|
||||
|
||||
[Obsolete("Scheduled for removal in v17")]
|
||||
public bool HasContent(bool preview) => HasContent();
|
||||
|
||||
[Obsolete("Scheduled for removal in v17")]
|
||||
public bool HasContent() => _documentUrlService.HasAny();
|
||||
|
||||
[Obsolete("Use IPublishedUrlProvider.GetUrl instead, scheduled for removal in v17")]
|
||||
public IPublishedContent? GetByRoute(bool preview, string route, bool? hideTopLevelNode = null, string? culture = null)
|
||||
{
|
||||
Guid? key = _documentUrlService.GetDocumentKeyByRoute(route, culture, null, preview);
|
||||
return key is not null ? GetById(preview, key.Value) : null;
|
||||
}
|
||||
|
||||
[Obsolete("Use IPublishedUrlProvider.GetUrl instead, scheduled for removal in v17")]
|
||||
public IPublishedContent? GetByRoute(string route, bool? hideTopLevelNode = null, string? culture = null)
|
||||
{
|
||||
Guid? key = _documentUrlService.GetDocumentKeyByRoute(route, culture, null, false);
|
||||
return key is not null ? GetById(key.Value) : null;
|
||||
}
|
||||
|
||||
[Obsolete("Use IPublishedUrlProvider.GetUrl instead, scheduled for removal in v17")]
|
||||
public string? GetRouteById(bool preview, int contentId, string? culture = null)
|
||||
{
|
||||
|
||||
@@ -33,29 +33,6 @@ public sealed class MediaCache : IPublishedMediaCache
|
||||
|
||||
public IPublishedContent? GetById(Guid contentId) => GetByIdAsync(contentId).GetAwaiter().GetResult();
|
||||
|
||||
|
||||
[Obsolete("Scheduled for removal in v17")]
|
||||
public IPublishedContent? GetById(bool preview, Udi contentId)
|
||||
{
|
||||
if(contentId is not GuidUdi guidUdi)
|
||||
{
|
||||
throw new NotSupportedException("Only GuidUdi is supported");
|
||||
}
|
||||
|
||||
return GetById(preview, guidUdi.Guid);
|
||||
}
|
||||
|
||||
[Obsolete("Scheduled for removal in v17")]
|
||||
public IPublishedContent? GetById(Udi contentId)
|
||||
{
|
||||
if(contentId is not GuidUdi guidUdi)
|
||||
{
|
||||
throw new NotSupportedException("Only GuidUdi is supported");
|
||||
}
|
||||
|
||||
return GetById(guidUdi.Guid);
|
||||
}
|
||||
|
||||
public IEnumerable<IPublishedContent> GetAtRoot(bool preview, string? culture = null)
|
||||
{
|
||||
_mediaNavigationQueryService.TryGetRootKeys(out IEnumerable<Guid> rootKeys);
|
||||
@@ -63,21 +40,4 @@ public sealed class MediaCache : IPublishedMediaCache
|
||||
IEnumerable<IPublishedContent> rootContent = rootKeys.Select(key => GetById(preview, key)).WhereNotNull();
|
||||
return culture is null ? rootContent : rootContent.Where(x => x.IsInvariantOrHasCulture(culture));
|
||||
}
|
||||
|
||||
public IEnumerable<IPublishedContent> GetAtRoot(string? culture = null)
|
||||
{
|
||||
_mediaNavigationQueryService.TryGetRootKeys(out IEnumerable<Guid> rootKeys);
|
||||
|
||||
IEnumerable<IPublishedContent> rootContent = rootKeys.Select(key => GetById(key)).WhereNotNull();
|
||||
return culture is null ? rootContent : rootContent.Where(x => x.IsInvariantOrHasCulture(culture));
|
||||
}
|
||||
|
||||
[Obsolete("Media does not support preview, this method will be removed in future versions")]
|
||||
public bool HasContent(bool preview) => HasContent();
|
||||
|
||||
public bool HasContent()
|
||||
{
|
||||
_mediaNavigationQueryService.TryGetRootKeys(out IEnumerable<Guid> rootKeys);
|
||||
return rootKeys.Any();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user