* Remove IExternalLoginService.cs * Remove UmbracoApplicationComponentsInstallingNotification.cs * Remove UmbracoApplicationMainDomAcquiredNotification.cs * Merge IContentTypeWithHistoryCleanup with IContentType.cs * Remove obsolete ctors from notifications * Remove obsolete methods * Remove obsolete method from RequestHandlerSettings.cs * Fix UmbracoBuilder.Repositories.cs * RemoveRemove obsolete constants * Remove obsolete method from IRuntimeMinifier * Remove SetLastLogin from IMemberRepository * Revert "RemoveRemove obsolete constants" This reverts commit cddb8ad1cf3d02bd9949d52bed91b45c8d2d66a9. * Remove obsoleted Constants-Conventions.cs * Remove obsolete ctors * Make ContentData properties immutable * remove obsolete static property from TestOptionAttributeBase * Merge IMacroWithAliasService into IMacroService * Remove IUserComposer * remove obsolete AddOEmbedProvider method * remove obsolete static EmbedProvidersCollectionBuilder * remove obsolete HasFlagAll<T> method * Remove obsolete LocalizedTextService property from BaseHttpHeaderCheck * Remove obsolete GetDefaultFIleContent method from ViewHelper * Remove more obsolete ctors and methods * Remove obsolete ctor from RelationType * Remove more obsolete methods * Remove IExternalLoginRepository * merge IMacroWithAliasRepository with IMacroRepository * Remove obsolete methods from ExternalLoginRepository * Remove obsolete method from IUserRepository * Remove obsolete SetLastLogin, as it was NoOp * Remove wierd SetLastLogin method from UserService * Remove GetLogLevel from ILogViewer * Remove more obsolete methods and ctors * Remove more obsoletes * Use other method in BackOfficeServerVariables.cs since GetAllTypes is now removed * Remove obsolete ctor * Remove ConfigureIISServerOptions * Remove more obsolete methods * Merge ITwoFactorLoginService2 with ITwoFactorLoginService * Re-introduce GetCustomGenericProperties in MemberTabsAndPropertiesMapper.cs Co-authored-by: Nikolaj Geisle <niko737@edu.ucl.dk>
62 lines
2.4 KiB
C#
62 lines
2.4 KiB
C#
using System;
|
|
using Umbraco.Cms.Core.Models.PublishedContent;
|
|
using Umbraco.Cms.Core.PublishedCache;
|
|
using Umbraco.Cms.Infrastructure.PublishedCache.DataSource;
|
|
|
|
namespace Umbraco.Cms.Infrastructure.PublishedCache
|
|
{
|
|
public struct ContentNodeKit
|
|
{
|
|
public ContentNode Node { get; } = null!;
|
|
|
|
public int ContentTypeId { get; }
|
|
|
|
public ContentData? DraftData { get; }
|
|
|
|
public ContentData? PublishedData { get; }
|
|
|
|
public ContentNodeKit(ContentNode node, int contentTypeId, ContentData? draftData, ContentData? publishedData)
|
|
{
|
|
Node = node;
|
|
ContentTypeId = contentTypeId;
|
|
DraftData = draftData;
|
|
PublishedData = publishedData;
|
|
}
|
|
|
|
|
|
public bool IsEmpty => Node == null;
|
|
|
|
public bool IsNull => ContentTypeId < 0;
|
|
|
|
public static ContentNodeKit Empty { get; } = new ContentNodeKit();
|
|
public static ContentNodeKit Null { get; } = new ContentNodeKit(null!, -1, null, null);
|
|
|
|
public void Build(
|
|
IPublishedContentType contentType,
|
|
IPublishedSnapshotAccessor publishedSnapshotAccessor,
|
|
IVariationContextAccessor variationContextAccessor,
|
|
IPublishedModelFactory publishedModelFactory,
|
|
bool canBePublished)
|
|
{
|
|
var draftData = DraftData;
|
|
|
|
// no published data if it cannot be published (eg is masked)
|
|
var publishedData = canBePublished ? PublishedData : null;
|
|
|
|
// we *must* have either published or draft data
|
|
// if it cannot be published, published data is going to be null
|
|
// therefore, ensure that draft data is not
|
|
if (draftData == null && !canBePublished)
|
|
draftData = PublishedData;
|
|
|
|
Node?.SetContentTypeAndData(contentType, draftData, publishedData, publishedSnapshotAccessor, variationContextAccessor, publishedModelFactory);
|
|
}
|
|
|
|
public ContentNodeKit Clone(IPublishedModelFactory publishedModelFactory)
|
|
=> new ContentNodeKit(new ContentNode(Node, publishedModelFactory), ContentTypeId, DraftData, PublishedData);
|
|
|
|
public ContentNodeKit Clone(IPublishedModelFactory publishedModelFactory, ContentData draftData, ContentData publishedData)
|
|
=> new ContentNodeKit(new ContentNode(Node, publishedModelFactory), ContentTypeId, draftData, publishedData);
|
|
}
|
|
}
|