Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/Umbraco.Core/Services/ContentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2406,6 +2406,8 @@ public OperationResult MoveToRecycleBin(IContent content, int userId = Constants

using (ICoreScope scope = ScopeProvider.CreateCoreScope())
{
var parentId = content.ParentId;

scope.WriteLock(Constants.Locks.ContentTree);

var originalPath = content.Path;
Expand Down Expand Up @@ -2438,6 +2440,14 @@ public OperationResult MoveToRecycleBin(IContent content, int userId = Constants
movingToRecycleBinNotification));
Audit(AuditType.Move, userId, content.Id, "Moved to recycle bin");

// sort the children of the parent after deleting the content
IQuery<IContent> childQuery = Query<IContent>().Where(x => x.ParentId == parentId && x.Id != content.Id);
IEnumerable<IContent> children = _documentRepository.Get(childQuery);
if(children.Any())
{
Sort(children, userId);
}

scope.Complete();
}

Expand All @@ -2459,6 +2469,8 @@ public OperationResult Move(IContent content, int parentId, int userId = Constan
{
EventMessages eventMessages = EventMessagesFactory.Get();

var parentIdBeforeMove = content.ParentId;

if (content.ParentId == parentId)
{
return OperationResult.Succeed(eventMessages);
Expand Down Expand Up @@ -2523,6 +2535,14 @@ public OperationResult Move(IContent content, int parentId, int userId = Constan

Audit(AuditType.Move, userId, content.Id);

// sort the children of the old parent after moving the content
IQuery<IContent> childQuery = Query<IContent>().Where(x => x.ParentId == parentIdBeforeMove && x.Id != content.Id);
IEnumerable<IContent> children = _documentRepository.Get(childQuery);
if (children.Any())
{
Sort(children, userId);
}

scope.Complete();
return OperationResult.Succeed(eventMessages);
}
Expand Down