Fixed duplications
This commit is contained in:
@@ -31,10 +31,7 @@ namespace Umbraco.Cms.Web.Common.Controllers
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!UmbracoContextAccessor.TryGetUmbracoContext(out var umbracoContext))
|
||||
{
|
||||
throw new InvalidOperationException("Wasn't able to get an UmbracoContext");
|
||||
}
|
||||
var umbracoContext = UmbracoContextAccessor.GetRequiredUmbracoContext();
|
||||
return umbracoContext;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ using Umbraco.Cms.Core.Routing;
|
||||
using Umbraco.Cms.Core.Web;
|
||||
using Umbraco.Cms.Web.Common.ActionsResults;
|
||||
using Umbraco.Cms.Web.Common.Filters;
|
||||
using Umbraco.Extensions;
|
||||
|
||||
namespace Umbraco.Cms.Web.Common.Controllers
|
||||
{
|
||||
@@ -42,10 +43,7 @@ namespace Umbraco.Cms.Web.Common.Controllers
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!_umbracoContextAccessor.TryGetUmbracoContext(out var umbracoContext))
|
||||
{
|
||||
throw new InvalidOperationException("Wasn't able to get an UmbracoContext");
|
||||
}
|
||||
var umbracoContext = _umbracoContextAccessor.GetRequiredUmbracoContext();
|
||||
return umbracoContext;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,11 +49,8 @@ namespace Umbraco.Extensions
|
||||
/// </remarks>
|
||||
public static string GetCultureFromDomains(this IPublishedContent content, IUmbracoContextAccessor umbracoContextAccessor, ISiteDomainMapper siteDomainHelper, Uri current = null)
|
||||
{
|
||||
if (!umbracoContextAccessor.TryGetUmbracoContext(out var umbracoContext))
|
||||
{
|
||||
throw new InvalidOperationException("Wasn't able to get an UmbracoContext");
|
||||
}
|
||||
return DomainUtilities.GetCultureFromDomains(content.Id, content.Path, current, umbracoContext, siteDomainHelper);
|
||||
var umbracoContext = umbracoContextAccessor.GetRequiredUmbracoContext();
|
||||
return DomainUtilities.GetCultureFromDomains(content.Id, content.Path, current, umbracoContext, siteDomainHelper);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -75,10 +72,7 @@ namespace Umbraco.Extensions
|
||||
.Field(UmbracoExamineFieldNames.IndexPathFieldName, (content.Path + ",").MultipleCharacterWildcard())
|
||||
.And()
|
||||
.ManagedQuery(term);
|
||||
if (!umbracoContextAccessor.TryGetUmbracoContext(out var umbracoContext))
|
||||
{
|
||||
throw new InvalidOperationException("Wasn't able to get an UmbracoContext");
|
||||
}
|
||||
var umbracoContext = umbracoContextAccessor.GetRequiredUmbracoContext();
|
||||
return query.Execute().ToPublishedSearchResults(umbracoContext.Content);
|
||||
}
|
||||
|
||||
@@ -97,10 +91,7 @@ namespace Umbraco.Extensions
|
||||
.Field("parentID", content.Id)
|
||||
.And()
|
||||
.ManagedQuery(term);
|
||||
if (!umbracoContextAccessor.TryGetUmbracoContext(out var umbracoContext))
|
||||
{
|
||||
throw new InvalidOperationException("Wasn't able to get an UmbracoContext");
|
||||
}
|
||||
var umbracoContext = umbracoContextAccessor.GetRequiredUmbracoContext();
|
||||
|
||||
return query.Execute().ToPublishedSearchResults(umbracoContext.Content);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user