Skip to content

Commit

Permalink
Merge branch 'v13/clean-root' of https://github.com/KevinJump/uSync i…
Browse files Browse the repository at this point in the history
…nto v13/clean-root
  • Loading branch information
KevinJump committed Aug 28, 2024
2 parents 89c6dfb + 67969ec commit bee140c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
13 changes: 12 additions & 1 deletion uSync.BackOffice/SyncHandlers/SyncHandlerContainerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,18 @@ public virtual IEnumerable<uSyncAction> ProcessPostImport(IEnumerable<uSyncActio
if (actions == null || !actions.Any())
return Enumerable.Empty<uSyncAction>();

return CleanFolders(-1);
var results = new List<uSyncAction>();

// we only do deletes here.
foreach (var action in actions.Where(x => x.Change == ChangeType.Hidden))
{
results.AddRange(
Import(action.FileName, config, SerializerFlags.LastPass));
}

results.AddRange(CleanFolders(-1));

return results;
}

/// <summary>
Expand Down
13 changes: 13 additions & 0 deletions uSync.Core/Serialization/SyncContainerSerializerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Umbraco.Cms.Core.Models.Entities;
using Umbraco.Cms.Core.Services;
using Umbraco.Extensions;
using uSync.Core.Models;

namespace uSync.Core.Serialization
{
Expand All @@ -26,6 +27,18 @@ public SyncContainerSerializerBase(IEntityService entityService, ILogger<SyncCon
this.containerType = containerType;
}

protected override SyncAttempt<TObject> ProcessDelete(Guid key, string alias, SerializerFlags flags)
{
if (flags.HasFlag(SerializerFlags.LastPass))
{
logger.LogDebug("Processing deletes as part of the last pass");
return base.ProcessDelete(key, alias, flags);
}

logger.LogDebug("Delete not processing as this is not the final pass");
return SyncAttempt<TObject>.Succeed(alias, ChangeType.Hidden);
}

protected override Attempt<TObject> FindOrCreate(XElement node)
{

Expand Down

0 comments on commit bee140c

Please sign in to comment.