Various fixes, and U4-11287
This commit is contained in:
@@ -1062,7 +1062,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
|
||||
NodeId = content.Id,
|
||||
LanguageId = LanguageRepository.GetIdByIsoCode(culture) ?? throw new InvalidOperationException("Not a valid culture."),
|
||||
Culture = culture,
|
||||
Edited = !content.IsCulturePublished(culture) || editedCultures.Contains(culture) // if not published, always edited
|
||||
Edited = !content.IsCulturePublished(culture) || (editedCultures != null && editedCultures.Contains(culture)) // if not published, always edited
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -435,7 +435,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The DTO used to fetch results for a content item with it's variation info
|
||||
/// The DTO used to fetch results for a content item with its variation info
|
||||
/// </summary>
|
||||
private class ContentEntityDto : BaseDto
|
||||
{
|
||||
@@ -483,6 +483,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
|
||||
public string Icon { get; set; }
|
||||
public string Thumbnail { get; set; }
|
||||
public bool IsContainer { get; set; }
|
||||
public ContentVariation Variations { get; set; }
|
||||
// ReSharper restore UnusedAutoPropertyAccessor.Local
|
||||
// ReSharper restore UnusedMember.Local
|
||||
}
|
||||
@@ -506,8 +507,8 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
|
||||
|
||||
if (isContent || isMedia)
|
||||
sql
|
||||
.AndSelect<ContentVersionDto>(x => NPocoSqlExtensions.Statics.Alias(x.Id, "versionId"))
|
||||
.AndSelect<ContentTypeDto>(x => x.Alias, x => x.Icon, x => x.Thumbnail, x => x.IsContainer);
|
||||
.AndSelect<ContentVersionDto>(x => Alias(x.Id, "versionId"))
|
||||
.AndSelect<ContentTypeDto>(x => x.Alias, x => x.Icon, x => x.Thumbnail, x => x.IsContainer, x => x.Variations);
|
||||
|
||||
if (isContent)
|
||||
{
|
||||
@@ -616,7 +617,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
|
||||
if (isContent || isMedia)
|
||||
sql
|
||||
.AndBy<ContentVersionDto>(x => x.Id)
|
||||
.AndBy<ContentTypeDto>(x => x.Alias, x => x.Icon, x => x.Thumbnail, x => x.IsContainer);
|
||||
.AndBy<ContentTypeDto>(x => x.Alias, x => x.Icon, x => x.Thumbnail, x => x.IsContainer, x => x.Variations);
|
||||
|
||||
if (sort)
|
||||
sql.OrderBy<NodeDto>(x => x.SortOrder);
|
||||
@@ -869,6 +870,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
|
||||
BuildContentEntity(entity, dto);
|
||||
entity.Published = dto.Published;
|
||||
entity.Edited = dto.Edited;
|
||||
entity.AdditionalData[EntitySlim.AdditionalVariations] = dto.Variations;
|
||||
}
|
||||
|
||||
private static EntitySlim BuildContentEntity(BaseDto dto)
|
||||
@@ -897,16 +899,16 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
|
||||
// EntitySlim does not track changes
|
||||
var entity = new DocumentEntitySlim();
|
||||
BuildDocumentEntity(entity, dto);
|
||||
var variantInfo = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
|
||||
if (dto.VariationInfo != null)
|
||||
if (dto.Variations.Has(ContentVariation.CultureNeutral) && dto.VariationInfo != null && dto.VariationInfo.Count > 0)
|
||||
{
|
||||
var variantInfo = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
|
||||
foreach (var info in dto.VariationInfo)
|
||||
{
|
||||
var isoCode = _langRepository.GetIsoCodeById(info.LanguageId);
|
||||
if (isoCode != null)
|
||||
variantInfo[isoCode] = info.Name;
|
||||
}
|
||||
entity.AdditionalData["CultureNames"] = variantInfo;
|
||||
entity.AdditionalData[EntitySlim.AdditionalCultureNames] = variantInfo;
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user