Skip to content

Commit

Permalink
Backward compat : Dependency Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Jump committed Jul 15, 2020
1 parent f55a4aa commit 1f365a8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions uSync8.BackOffice/SyncHandlers/SyncHandlerRoot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ public SyncHandlerRoot(
this.itemFactory = itemFactory ?? Current.Factory.GetInstance<ISyncItemFactory>();

this.serializer = serializer;
this.trackers = itemFactory.GetTrackers<TObject>().ToList();
this.dependencyCheckers = itemFactory.GetCheckers<TObject>().ToList();
this.trackers = this.itemFactory.GetTrackers<TObject>().ToList();
this.dependencyCheckers = this.itemFactory.GetCheckers<TObject>().ToList();

this.syncFileService = syncFileService;

Expand Down
11 changes: 7 additions & 4 deletions uSync8.ContentEdition/Checkers/ContentBaseChecker.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using System.Collections.Generic;
using System.Linq;

using Serilog.Core;

using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Services;
Expand All @@ -14,7 +17,7 @@ public abstract class ContentBaseChecker
{
protected readonly IEntityService entityService;
private UmbracoObjectTypes contentTypeObjectType;
private SyncValueMapperCollection mappers;
private SyncValueMapperCollection mapperCollection;

public UmbracoObjectTypes ObjectType { get; protected set; } = UmbracoObjectTypes.Unknown;

Expand All @@ -25,7 +28,7 @@ public ContentBaseChecker(IEntityService entityService,
this.entityService = entityService;
this.contentTypeObjectType = contentTypeObjectType;

this.mappers = mappers;
this.mapperCollection = mappers;
}

protected uSyncDependency CalcDocTypeDependency(IContentBase item, DependencyFlags flags)
Expand Down Expand Up @@ -155,14 +158,14 @@ protected IEnumerable<uSyncDependency> GetPropertyDependencies(IContentBase item
foreach (var property in item.Properties)
{
var editorAlias = property.PropertyType.PropertyEditorAlias;
var valueMappers = mappers.GetSyncMappers(editorAlias);
var valueMappers = mapperCollection.GetSyncMappers(editorAlias);
if (valueMappers.Any())
{
foreach(var value in property.Values)
{
if (value.EditedValue == null) continue;

foreach (var mapper in mappers)
foreach (var mapper in valueMappers)
{
var linkedDependencies = mapper.GetDependencies(value.EditedValue, editorAlias, propertyFlags);

Expand Down
2 changes: 1 addition & 1 deletion uSync8.ContentEdition/Mapping/Mappers/GridMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ private IEnumerable<uSyncDependency> ProcessControl(JObject control, DependencyF
if (value == null) return Enumerable.Empty<uSyncDependency>();

var (alias, mappers) = FindMappers(editor);
if (!mappers.Any()) return Enumerable.Empty<uSyncDependency>();
if (mappers == null || !mappers.Any()) return Enumerable.Empty<uSyncDependency>();

var dependencies = new List<uSyncDependency>();

Expand Down

0 comments on commit 1f365a8

Please sign in to comment.