Merge branch 'netcore/feature/AB5822-smidge-implementation' of https://github.com/umbraco/Umbraco-CMS into netcore/feature/AB5822-smidge-implementation

This commit is contained in:
Shannon
2020-04-02 17:41:19 +11:00
103 changed files with 2032 additions and 1301 deletions

View File

@@ -5,7 +5,7 @@ using Umbraco.Net;
namespace Umbraco.Web.AspNet
{
public class AspNetUmbracoApplicationLifetime : IUmbracoApplicationLifetimeManager
public class AspNetUmbracoApplicationLifetime : IUmbracoApplicationLifetime, IUmbracoApplicationLifetimeManager
{
private readonly IHttpContextAccessor _httpContextAccessor;

View File

@@ -230,21 +230,27 @@ namespace Umbraco.Web
}
}
if (!lengthReached && currentTextLength >= length)
if (!lengthReached)
{
// if the last character added was the first of a two character unicode pair, add the second character
if (Char.IsHighSurrogate((char)ic))
if (currentTextLength == length)
{
var lowSurrogate = tr.Read();
outputtw.Write((char)lowSurrogate);
}
// if the last character added was the first of a two character unicode pair, add the second character
if (char.IsHighSurrogate((char)ic))
{
var lowSurrogate = tr.Read();
outputtw.Write((char)lowSurrogate);
}
// Reached truncate limit.
if (addElipsis)
{
outputtw.Write(hellip);
}
lengthReached = true;
// only add elipsis if current length greater than original length
if (currentTextLength > length)
{
if (addElipsis)
{
outputtw.Write(hellip);
}
lengthReached = true;
}
}
}

View File

@@ -66,12 +66,18 @@ namespace Umbraco.Web.Macros
#region MacroContent cache
// gets this macro content cache identifier
private string GetContentCacheIdentifier(MacroModel model, int pageId)
private string GetContentCacheIdentifier(MacroModel model, int pageId, string cultureName)
{
var id = new StringBuilder();
var alias = model.Alias;
id.AppendFormat("{0}-", alias);
//always add current culture to the key to allow variants to have different cache results
if (!string.IsNullOrEmpty(cultureName))
{
// are there any unusual culture formats we'd need to handle?
id.AppendFormat("{0}-", cultureName);
}
if (model.CacheByPage)
id.AppendFormat("{0}-", pageId);
@@ -220,7 +226,8 @@ namespace Umbraco.Web.Macros
foreach (var prop in macro.Properties)
prop.Value = ParseAttribute(prop.Value);
macro.CacheIdentifier = GetContentCacheIdentifier(macro, content.Id);
var cultureName = System.Threading.Thread.CurrentThread.CurrentUICulture.Name;
macro.CacheIdentifier = GetContentCacheIdentifier(macro, content.Id, cultureName);
// get the macro from cache if it is there
var macroContent = GetMacroContentFromCache(macro);

View File

@@ -289,7 +289,7 @@ namespace Umbraco.Web
/// <param name="culture">The specific culture to filter for. If null is used the current culture is used. (Default is null)</param>
/// <returns></returns>
/// <remarks>
/// This can be useful in order to return all nodes in an entire site by a type when combined with TypedContentAtRoot
/// This can be useful in order to return all nodes in an entire site by a type when combined with <see cref="UmbracoHelper.ContentAtRoot"/> or similar.
/// </remarks>
public static IEnumerable<IPublishedContent> DescendantsOrSelfOfType(this IEnumerable<IPublishedContent> parentNodes, string docTypeAlias, string culture = null)
{
@@ -303,7 +303,7 @@ namespace Umbraco.Web
/// <param name="culture">The specific culture to filter for. If null is used the current culture is used. (Default is null)</param>
/// <returns></returns>
/// <remarks>
/// This can be useful in order to return all nodes in an entire site by a type when combined with TypedContentAtRoot
/// This can be useful in order to return all nodes in an entire site by a type when combined with <see cref="UmbracoHelper.ContentAtRoot"/> or similar.
/// </remarks>
public static IEnumerable<T> DescendantsOrSelf<T>(this IEnumerable<IPublishedContent> parentNodes, string culture = null)
where T : class, IPublishedContent

View File

@@ -23,7 +23,7 @@ namespace Umbraco.Web.Security
string[] defaultUserGroups = null,
string defaultCulture = null)
{
_defaultUserGroups = defaultUserGroups ?? new[] { "editor" };
_defaultUserGroups = defaultUserGroups ?? new[] { Constants.Security.EditorGroupAlias };
_autoLinkExternalAccount = autoLinkExternalAccount;
_defaultCulture = defaultCulture ?? Current.Configs.Global().DefaultUILanguage;
}