Removed Url stuff from UmbracoContext
This commit is contained in:
@@ -16,11 +16,6 @@ namespace Umbraco.Web
|
||||
/// </summary>
|
||||
DateTime ObjectCreated { get; }
|
||||
|
||||
/// <summary>
|
||||
/// This is used internally for debugging and also used to define anything required to distinguish this request from another.
|
||||
/// </summary>
|
||||
Guid UmbracoRequestId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the WebSecurity class
|
||||
/// </summary>
|
||||
@@ -83,40 +78,6 @@ namespace Umbraco.Web
|
||||
/// </summary>
|
||||
bool InPreviewMode { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the url of a content identified by its identifier.
|
||||
/// </summary>
|
||||
/// <param name="contentId">The content identifier.</param>
|
||||
/// <param name="culture"></param>
|
||||
/// <returns>The url for the content.</returns>
|
||||
string Url(int contentId, string culture = null);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the url of a content identified by its identifier.
|
||||
/// </summary>
|
||||
/// <param name="contentId">The content identifier.</param>
|
||||
/// <param name="culture"></param>
|
||||
/// <returns>The url for the content.</returns>
|
||||
string Url(Guid contentId, string culture = null);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the url of a content identified by its identifier, in a specified mode.
|
||||
/// </summary>
|
||||
/// <param name="contentId">The content identifier.</param>
|
||||
/// <param name="mode">The mode.</param>
|
||||
/// <param name="culture"></param>
|
||||
/// <returns>The url for the content.</returns>
|
||||
string Url(int contentId, UrlMode mode, string culture = null);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the url of a content identified by its identifier, in a specified mode.
|
||||
/// </summary>
|
||||
/// <param name="contentId">The content identifier.</param>
|
||||
/// <param name="mode">The mode.</param>
|
||||
/// <param name="culture"></param>
|
||||
/// <returns>The url for the content.</returns>
|
||||
string Url(Guid contentId, UrlMode mode, string culture = null);
|
||||
|
||||
IDisposable ForcedPreview(bool preview);
|
||||
void Dispose();
|
||||
}
|
||||
|
||||
@@ -411,7 +411,7 @@ namespace Umbraco.Web.Editors
|
||||
/// <returns></returns>
|
||||
public HttpResponseMessage GetNiceUrl(int id)
|
||||
{
|
||||
var url = UmbracoContext.Url(id);
|
||||
var url = PublishedUrlProvider.GetUrl(id);
|
||||
var response = Request.CreateResponse(HttpStatusCode.OK);
|
||||
response.Content = new StringContent(url, Encoding.UTF8, "text/plain");
|
||||
return response;
|
||||
@@ -424,7 +424,7 @@ namespace Umbraco.Web.Editors
|
||||
/// <returns></returns>
|
||||
public HttpResponseMessage GetNiceUrl(Guid id)
|
||||
{
|
||||
var url = UmbracoContext.Url(id);
|
||||
var url = PublishedUrlProvider.GetUrl(id);
|
||||
var response = Request.CreateResponse(HttpStatusCode.OK);
|
||||
response.Content = new StringContent(url, Encoding.UTF8, "text/plain");
|
||||
return response;
|
||||
|
||||
@@ -268,7 +268,7 @@ namespace Umbraco.Web.Editors
|
||||
|
||||
if (type == UmbracoEntityTypes.Document)
|
||||
{
|
||||
var foundUrl = UmbracoContext.Url(id, culture);
|
||||
var foundUrl = PublishedUrlProvider.GetUrl(id, culture: culture);
|
||||
if (string.IsNullOrEmpty(foundUrl) == false && foundUrl != "#")
|
||||
{
|
||||
returnUrl = foundUrl;
|
||||
|
||||
@@ -10,6 +10,7 @@ using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Examine;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
using Umbraco.Web.Routing;
|
||||
using Umbraco.Web.Trees;
|
||||
|
||||
namespace Umbraco.Web.Search
|
||||
@@ -20,26 +21,28 @@ namespace Umbraco.Web.Search
|
||||
/// </summary>
|
||||
public class UmbracoTreeSearcher
|
||||
{
|
||||
private readonly IUmbracoContext _umbracoContext;
|
||||
private readonly ILocalizationService _languageService;
|
||||
private readonly IEntityService _entityService;
|
||||
private readonly UmbracoMapper _mapper;
|
||||
private readonly ISqlContext _sqlContext;
|
||||
private readonly IBackOfficeExamineSearcher _backOfficeExamineSearcher;
|
||||
private readonly IPublishedUrlProvider _publishedUrlProvider;
|
||||
|
||||
|
||||
public UmbracoTreeSearcher(IUmbracoContext umbracoContext,
|
||||
public UmbracoTreeSearcher(
|
||||
ILocalizationService languageService,
|
||||
IEntityService entityService,
|
||||
UmbracoMapper mapper,
|
||||
ISqlContext sqlContext, IBackOfficeExamineSearcher backOfficeExamineSearcher)
|
||||
ISqlContext sqlContext,
|
||||
IBackOfficeExamineSearcher backOfficeExamineSearcher,
|
||||
IPublishedUrlProvider publishedUrlProvider)
|
||||
{
|
||||
_umbracoContext = umbracoContext;
|
||||
_languageService = languageService;
|
||||
_entityService = entityService;
|
||||
_mapper = mapper;
|
||||
_sqlContext = sqlContext;
|
||||
_backOfficeExamineSearcher = backOfficeExamineSearcher;
|
||||
_publishedUrlProvider = publishedUrlProvider;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -157,11 +160,11 @@ namespace Umbraco.Web.Search
|
||||
//if it varies by culture, return the default language URL
|
||||
if (result.Values.TryGetValue(UmbracoExamineFieldNames.VariesByCultureFieldName, out var varies) && varies == "y")
|
||||
{
|
||||
entity.AdditionalData["Url"] = _umbracoContext.Url(intId.Result, defaultLang);
|
||||
entity.AdditionalData["Url"] = _publishedUrlProvider.GetUrl(intId.Result, culture: defaultLang);
|
||||
}
|
||||
else
|
||||
{
|
||||
entity.AdditionalData["Url"] = _umbracoContext.Url(intId.Result);
|
||||
entity.AdditionalData["Url"] = _publishedUrlProvider.GetUrl(intId.Result);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -169,56 +169,6 @@ namespace Umbraco.Web
|
||||
private set => _previewing = value;
|
||||
}
|
||||
|
||||
#region Urls
|
||||
|
||||
/// <summary>
|
||||
/// Gets the url of a content identified by its identifier.
|
||||
/// </summary>
|
||||
/// <param name="contentId">The content identifier.</param>
|
||||
/// <param name="culture"></param>
|
||||
/// <returns>The url for the content.</returns>
|
||||
public string Url(int contentId, string culture = null)
|
||||
{
|
||||
return _publishedUrlProvider.GetUrl(contentId, culture: culture);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the url of a content identified by its identifier.
|
||||
/// </summary>
|
||||
/// <param name="contentId">The content identifier.</param>
|
||||
/// <param name="culture"></param>
|
||||
/// <returns>The url for the content.</returns>
|
||||
public string Url(Guid contentId, string culture = null)
|
||||
{
|
||||
return _publishedUrlProvider.GetUrl(contentId, culture: culture);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the url of a content identified by its identifier, in a specified mode.
|
||||
/// </summary>
|
||||
/// <param name="contentId">The content identifier.</param>
|
||||
/// <param name="mode">The mode.</param>
|
||||
/// <param name="culture"></param>
|
||||
/// <returns>The url for the content.</returns>
|
||||
public string Url(int contentId, UrlMode mode, string culture = null)
|
||||
{
|
||||
return _publishedUrlProvider.GetUrl(contentId, mode, culture);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the url of a content identified by its identifier, in a specified mode.
|
||||
/// </summary>
|
||||
/// <param name="contentId">The content identifier.</param>
|
||||
/// <param name="mode">The mode.</param>
|
||||
/// <param name="culture"></param>
|
||||
/// <returns>The url for the content.</returns>
|
||||
public string Url(Guid contentId, UrlMode mode, string culture = null)
|
||||
{
|
||||
return _publishedUrlProvider.GetUrl(contentId, mode, culture);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public string PreviewToken
|
||||
{
|
||||
get
|
||||
|
||||
Reference in New Issue
Block a user