Cherry-pick: support import/export for doc type history cleanup policy (#11708)

* cherry-pick 13a51d32 (V8 History cleanup import/export)

Support import/export for doc type history cleanup policy (#11660)

* Support import/export for doc type history cleanup policy

* Support unset/null history cleanup value

* Resolve issue when api endpoints called without cleanup policy.
noop isn't good enough as map fails for response.

* null conditional vs null coalesce assignment

* Don't overwrite existing policy if omitted in import XML

* Update history cleanup warning and translations

* Change history cleanup alert to infomational styling

* Remove margin around history cleanup config

Co-authored-by: Ronald Barendse <ronald@barend.se>
# Conflicts:
#	src/Umbraco.Core/Models/IContentType.cs
#	src/Umbraco.Core/Packaging/PackageDataInstallation.cs
#	src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeRepository.cs
#	src/Umbraco.Infrastructure/Services/Implement/EntityXmlSerializer.cs
#	src/Umbraco.Tests/Packaging/PackageDataInstallationTests.cs
#	src/Umbraco.Tests/Services/Importing/ImportResources.Designer.cs
#	src/Umbraco.Tests/Umbraco.Tests.csproj
#	src/Umbraco.Web.UI/umbraco/config/lang/en.xml
#	src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml
#	src/Umbraco.Web/Models/Mapping/ContentTypeMapDefinition.cs
#	tests/Umbraco.Tests.Integration/Umbraco.Infrastructure/Services/Importing/ImportResources.resx
#	tests/Umbraco.Tests.UnitTests/Umbraco.Core/Services/Importing/SingleDocType-WithCleanupPolicy.xml

* Remove namespace aliases

* Update IContentTypeWithHistoryCleanup documentation

Co-authored-by: Ronald Barendse <ronald@barend.se>
This commit is contained in:
Paul Johnson
2021-12-02 10:37:12 +00:00
committed by GitHub
parent 08f106a23f
commit fce97314bd
13 changed files with 321 additions and 69 deletions

View File

@@ -185,20 +185,15 @@ namespace Umbraco.Cms.Core.Models.Mapping
{
target.HistoryCleanup = new HistoryCleanupViewModel
{
PreventCleanup = sourceWithHistoryCleanup.HistoryCleanup.PreventCleanup,
KeepAllVersionsNewerThanDays =
sourceWithHistoryCleanup.HistoryCleanup.KeepAllVersionsNewerThanDays,
KeepLatestVersionPerDayForDays =
sourceWithHistoryCleanup.HistoryCleanup.KeepLatestVersionPerDayForDays,
GlobalKeepAllVersionsNewerThanDays =
_contentSettings.ContentVersionCleanupPolicy.KeepAllVersionsNewerThanDays,
GlobalKeepLatestVersionPerDayForDays =
_contentSettings.ContentVersionCleanupPolicy.KeepLatestVersionPerDayForDays,
PreventCleanup = sourceWithHistoryCleanup.HistoryCleanup?.PreventCleanup ?? false,
KeepAllVersionsNewerThanDays = sourceWithHistoryCleanup.HistoryCleanup?.KeepAllVersionsNewerThanDays,
KeepLatestVersionPerDayForDays = sourceWithHistoryCleanup.HistoryCleanup?.KeepLatestVersionPerDayForDays,
GlobalKeepAllVersionsNewerThanDays = _contentSettings.ContentVersionCleanupPolicy.KeepAllVersionsNewerThanDays,
GlobalKeepLatestVersionPerDayForDays = _contentSettings.ContentVersionCleanupPolicy.KeepLatestVersionPerDayForDays,
GlobalEnableCleanup = _contentSettings.ContentVersionCleanupPolicy.EnableCleanup
};
}
target.AllowCultureVariant = source.VariesByCulture();
target.AllowSegmentVariant = source.VariesBySegment();
target.ContentApps = _commonMapper.GetContentApps(source);