Skip to content

Commit

Permalink
use correct alias names for delete relationship types.
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinJump committed Oct 4, 2023
1 parent c38cabd commit 5830d43
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions uSync.Core/Serialization/Serializers/ContentSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,11 @@ protected override uSyncChange HandleTrashedState(IContent item, bool trashed, G
// should restore it (as long as we do a move!)


var restoreParentId = GetRelationParentId(item, restoreParentKey, Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteAlias);
var restoreParentId = GetRelationParentId(item, restoreParentKey, Constants.Conventions.RelationTypes.RelateParentMediaFolderOnDeleteAlias);
contentService.Move(item, restoreParentId);

// clean out any relations for this item (some versions of Umbraco don't do this on a Move)
CleanRelations(item, Constants.Conventions.RelationTypes.RelateDocumentOnCopyAlias);
CleanRelations(item, Constants.Conventions.RelationTypes.RelateParentMediaFolderOnDeleteAlias);

return uSyncChange.Update("Restored", item.Name, "Recycle Bin", restoreParentKey.ToString());

Expand All @@ -374,7 +374,7 @@ protected override uSyncChange HandleTrashedState(IContent item, bool trashed, G
if (item.ParentId > Constants.System.RecycleBinContent)
{
// clean any relations that may be there (stops an error)
CleanRelations(item, "relateParentDocumentOnDelete");
CleanRelations(item, Constants.Conventions.RelationTypes.RelateParentMediaFolderOnDeleteAlias);

// move to the recycle bin
contentService.MoveToRecycleBin(item);
Expand Down
6 changes: 3 additions & 3 deletions uSync.Core/Serialization/Serializers/MediaSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,17 @@ protected override uSyncChange HandleTrashedState(IMedia item, bool trashed, Gui
// if the item is trashed, then moving it back to the parent value
// restores it.

var restoreParentId = GetRelationParentId(item, restoreParentKey, Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteAlias);
var restoreParentId = GetRelationParentId(item, restoreParentKey, Constants.Conventions.RelationTypes.RelateParentMediaFolderOnDeleteAlias);
_mediaService.Move(item, restoreParentId);

CleanRelations(item, "relateParentMediaFolderOnDelete");
CleanRelations(item, Constants.Conventions.RelationTypes.RelateParentMediaFolderOnDeleteAlias);

return uSyncChange.Update("Restored", item.Name, "Recycle Bin", item.ParentId.ToString());
}
else if (trashed && !item.Trashed)
{
// clean any rouge relations
CleanRelations(item, "relateParentMediaFolderOnDelete");
CleanRelations(item, Constants.Conventions.RelationTypes.RelateParentMediaFolderOnDeleteAlias);

// move to the recycle bin
_mediaService.MoveToRecycleBin(item);
Expand Down

0 comments on commit 5830d43

Please sign in to comment.