Skip to content

Commit 236bf88

Browse files
committed
Cleanup
1 parent a25183a commit 236bf88

File tree

14 files changed

+45
-41
lines changed

14 files changed

+45
-41
lines changed

src/Umbraco.Core/Models/ContentEditing/DocumentTypeDisplay.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections.Generic;
1+
using System.Collections.Generic;
22
using System.Runtime.Serialization;
33

44
namespace Umbraco.Cms.Core.Models.ContentEditing
@@ -16,16 +16,19 @@ public DocumentTypeDisplay() =>
1616
[DataMember(Name = "allowedTemplates")]
1717
public IEnumerable<EntityBasic> AllowedTemplates { get; set; }
1818

19-
[DataMember(Name = "defaultTemplate")] public EntityBasic DefaultTemplate { get; set; }
19+
[DataMember(Name = "defaultTemplate")]
20+
public EntityBasic DefaultTemplate { get; set; }
2021

2122
[DataMember(Name = "allowCultureVariant")]
2223
public bool AllowCultureVariant { get; set; }
2324

2425
[DataMember(Name = "allowSegmentVariant")]
2526
public bool AllowSegmentVariant { get; set; }
2627

27-
[DataMember(Name = "apps")] public IEnumerable<ContentApp> ContentApps { get; set; }
28+
[DataMember(Name = "apps")]
29+
public IEnumerable<ContentApp> ContentApps { get; set; }
2830

29-
[DataMember(Name = "historyCleanup")] public HistoryCleanupViewModel HistoryCleanup { get; set; }
31+
[DataMember(Name = "historyCleanup")]
32+
public HistoryCleanupViewModel HistoryCleanup { get; set; }
3033
}
3134
}

src/Umbraco.Core/Models/ContentEditing/HistoryCleanup.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ namespace Umbraco.Cms.Core.Models.ContentEditing
55
[DataContract(Name = "historyCleanup", Namespace = "")]
66
public class HistoryCleanup
77
{
8-
[DataMember(Name = "preventCleanup")] public bool PreventCleanup { get; set; }
8+
[DataMember(Name = "preventCleanup")]
9+
public bool PreventCleanup { get; set; }
910

1011
[DataMember(Name = "keepAllVersionsNewerThanDays")]
1112
public int? KeepAllVersionsNewerThanDays { get; set; }

src/Umbraco.Core/Models/ContentEditing/HistoryCleanupViewModel.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ namespace Umbraco.Cms.Core.Models.ContentEditing
55
[DataContract(Name = "historyCleanup", Namespace = "")]
66
public class HistoryCleanupViewModel : HistoryCleanup
77
{
8-
[DataMember(Name = "globalKeepAllVersionsNewerThanDays")]
9-
public int? GlobalKeepAllVersionsNewerThanDays { get;set; }
10-
11-
[DataMember(Name = "globalKeepLatestVersionPerDayForDays")]
12-
public int? GlobalKeepLatestVersionPerDayForDays { get; set;}
138

149
[DataMember(Name = "globalEnableCleanup")]
1510
public bool GlobalEnableCleanup { get; set; }
11+
12+
[DataMember(Name = "globalKeepAllVersionsNewerThanDays")]
13+
public int? GlobalKeepAllVersionsNewerThanDays { get; set; }
14+
15+
[DataMember(Name = "globalKeepLatestVersionPerDayForDays")]
16+
public int? GlobalKeepLatestVersionPerDayForDays { get; set; }
1617
}
1718
}

src/Umbraco.Core/Models/ContentType.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Runtime.Serialization;
@@ -17,9 +17,8 @@ public class ContentType : ContentTypeCompositionBase, IContentTypeWithHistoryCl
1717
{
1818
public const bool SupportsPublishingConst = true;
1919

20-
21-
//Custom comparer for enumerable
22-
private static readonly DelegateEqualityComparer<IEnumerable<ITemplate>> TemplateComparer = new(
20+
// Custom comparer for enumerable
21+
private static readonly DelegateEqualityComparer<IEnumerable<ITemplate>> TemplateComparer = new (
2322
(templates, enumerable) => templates.UnsortedSequenceEqual(enumerable),
2423
templates => templates.GetHashCode());
2524

@@ -88,8 +87,7 @@ public IEnumerable<ITemplate> AllowedTemplates
8887
get => _allowedTemplates;
8988
set
9089
{
91-
SetPropertyValueAndDetectChanges(value, ref _allowedTemplates, nameof(AllowedTemplates),
92-
TemplateComparer);
90+
SetPropertyValueAndDetectChanges(value, ref _allowedTemplates, nameof(AllowedTemplates), TemplateComparer);
9391

9492
if (_allowedTemplates.Any(x => x.Id == _defaultTemplate) == false)
9593
{

src/Umbraco.Core/Models/ContentVersionCleanupPolicySettings.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ namespace Umbraco.Cms.Core.Models
55
public class ContentVersionCleanupPolicySettings
66
{
77
public int ContentTypeId { get; set; }
8+
9+
public bool PreventCleanup { get; set; }
10+
811
public int? KeepAllVersionsNewerThanDays { get; set; }
12+
913
public int? KeepLatestVersionPerDayForDays { get; set; }
10-
public bool PreventCleanup { get; set; }
14+
1115
public DateTime Updated { get; set; }
1216
}
1317
}

src/Umbraco.Core/Models/IContentType.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using Umbraco.Cms.Core.Models.ContentEditing;
44

@@ -13,7 +13,6 @@ public interface IContentTypeWithHistoryCleanup : IContentType
1313
HistoryCleanup HistoryCleanup { get; set; }
1414
}
1515

16-
1716
/// <summary>
1817
/// Defines a ContentType, which Content is based on
1918
/// </summary>

src/Umbraco.Infrastructure/Persistence/Dtos/ContentVersionCleanupPolicyDto.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using Umbraco.Cms.Core;
55
using Umbraco.Cms.Infrastructure.Persistence.DatabaseAnnotations;
66

7-
87
namespace Umbraco.Cms.Infrastructure.Persistence.Dtos
98
{
109
[TableName(TableName)]
@@ -18,6 +17,9 @@ internal class ContentVersionCleanupPolicyDto
1817
[ForeignKey(typeof(ContentTypeDto), Column = "nodeId", OnDelete = Rule.Cascade)]
1918
public int ContentTypeId { get; set; }
2019

20+
[Column("preventCleanup")]
21+
public bool PreventCleanup { get; set; }
22+
2123
[Column("keepAllVersionsNewerThanDays")]
2224
[NullSetting(NullSetting = NullSettings.Null)]
2325
public int? KeepAllVersionsNewerThanDays { get; set; }
@@ -26,9 +28,6 @@ internal class ContentVersionCleanupPolicyDto
2628
[NullSetting(NullSetting = NullSettings.Null)]
2729
public int? KeepLatestVersionPerDayForDays { get; set; }
2830

29-
[Column("preventCleanup")]
30-
public bool PreventCleanup { get; set; }
31-
3231
[Column("updated")]
3332
public DateTime Updated { get; set; }
3433
}

src/Umbraco.Infrastructure/Persistence/Repositories/Implement/ContentTypeRepository.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Linq;
44
using Microsoft.Extensions.Logging;
@@ -305,7 +305,7 @@ private void PersistHistoryCleanup(IContentType entity)
305305
Updated = DateTime.Now,
306306
PreventCleanup = entityWithHistoryCleanup.HistoryCleanup.PreventCleanup,
307307
KeepAllVersionsNewerThanDays = entityWithHistoryCleanup.HistoryCleanup.KeepAllVersionsNewerThanDays,
308-
KeepLatestVersionPerDayForDays = entityWithHistoryCleanup.HistoryCleanup.KeepLatestVersionPerDayForDays,
308+
KeepLatestVersionPerDayForDays = entityWithHistoryCleanup.HistoryCleanup.KeepLatestVersionPerDayForDays
309309
};
310310
Database.InsertOrUpdate(dto);
311311
}

src/Umbraco.Infrastructure/Services/Implement/ContentService.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,19 @@ public OperationResult Rollback(int id, int versionId, string culture = "*",
7474
{
7575
EventMessages evtMsgs = EventMessagesFactory.Get();
7676

77-
//Get the current copy of the node
77+
// Get the current copy of the node
7878
IContent content = GetById(id);
7979

80-
//Get the version
80+
// Get the version
8181
IContent version = GetVersion(versionId);
8282

83-
//Good ole null checks
83+
// Good old null checks
8484
if (content == null || version == null || content.Trashed)
8585
{
8686
return new OperationResult(OperationResultType.FailedCannot, evtMsgs);
8787
}
8888

89-
//Store the result of doing the save of content for the rollback
89+
// Store the result of doing the save of content for the rollback
9090
OperationResult rollbackSaveResult;
9191

9292
using (IScope scope = ScopeProvider.CreateScope())
@@ -98,16 +98,16 @@ public OperationResult Rollback(int id, int versionId, string culture = "*",
9898
return OperationResult.Cancel(evtMsgs);
9999
}
100100

101-
//Copy the changes from the version
101+
// Copy the changes from the version
102102
content.CopyFrom(version, culture);
103103

104-
//Save the content for the rollback
104+
// Save the content for the rollback
105105
rollbackSaveResult = Save(content, userId);
106106

107-
//Depending on the save result - is what we log & audit along with what we return
107+
// Depending on the save result - is what we log & audit along with what we return
108108
if (rollbackSaveResult.Success == false)
109109
{
110-
//Log the error/warning
110+
// Log the error/warning
111111
_logger.LogError(
112112
"User '{UserId}' was unable to rollback content '{ContentId}' to version '{VersionId}'", userId,
113113
id, versionId);
@@ -117,7 +117,7 @@ public OperationResult Rollback(int id, int versionId, string culture = "*",
117117
scope.Notifications.Publish(
118118
new ContentRolledBackNotification(content, evtMsgs).WithStateFrom(rollingBackNotification));
119119

120-
//Logging & Audit message
120+
// Logging & Audit message
121121
_logger.LogInformation("User '{UserId}' rolled back content '{ContentId}' to version '{VersionId}'",
122122
userId, id, versionId);
123123
Audit(AuditType.RollBack, userId, id,
@@ -1799,6 +1799,7 @@ private void PerformScheduledPublishingRelease(DateTime date, List<PublishResult
17991799
publishing &= tryPublish; //set the culture to be published
18001800
if (!publishing)
18011801
{
1802+
continue;
18021803
}
18031804
}
18041805

src/Umbraco.Web.UI.Client/src/common/services/umbdataformatter.service.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
var saveModel = _.pick(displayModel,
6464
'compositeContentTypes', 'isContainer', 'allowAsRoot', 'allowedTemplates', 'allowedContentTypes',
6565
'alias', 'description', 'thumbnail', 'name', 'id', 'icon', 'trashed',
66-
'key', 'parentId', 'alias', 'path', 'allowCultureVariant', 'allowSegmentVariant', 'isElement','historyCleanup');
66+
'key', 'parentId', 'alias', 'path', 'allowCultureVariant', 'allowSegmentVariant', 'isElement', 'historyCleanup');
6767

6868
saveModel.allowedTemplates = _.map(displayModel.allowedTemplates, function (t) { return t.alias; });
6969
saveModel.defaultTemplate = displayModel.defaultTemplate ? displayModel.defaultTemplate.alias : null;

0 commit comments

Comments
 (0)