Skip to content

Commit

Permalink
Clean relations pre - trash.
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinJump committed Jun 29, 2021
1 parent f41034d commit b1d671a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion uSync8.ContentEdition/Serializers/ContentSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,11 @@ protected override uSyncChange HandleTrashedState(IContent item, bool trashed)
else if (trashed && !item.Trashed)
{
// move to the recycle bin

logger.Debug<ContentSerializer>("Moving content into Recycle bin {id}", item.Id);

// clean any relations that may be there (stops an error)
CleanRelations(item, "relateParentDocumentOnDelete");

contentService.MoveToRecycleBin(item);
return uSyncChange.Update("Moved to Bin", item.Name, "", "Recycle Bin");
}
Expand Down
4 changes: 4 additions & 0 deletions uSync8.ContentEdition/Serializers/MediaSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ protected override uSyncChange HandleTrashedState(IMedia item, bool trashed)
}
else if (trashed && !item.Trashed)
{

// clean any rouge relations
CleanRelations(item, "relateParentMediaFolderOnDelete");

// move to the recycle bin
mediaService.MoveToRecycleBin(item);
return uSyncChange.Update("Moved to Bin", item.Name, "", "Recycle Bin");
Expand Down

0 comments on commit b1d671a

Please sign in to comment.