From 703037195aabd9237ad6af0e649333f2494ff2ba Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Mon, 31 Aug 2020 23:20:18 +0200 Subject: [PATCH] Revert "Preserve sort order when copying content" This reverts commit 47dc631ca0862ba1e09162637288a024b24c7a1a. --- .../Services/Implement/ContentService.cs | 2 +- .../Services/ContentServiceTests.cs | 27 ------------------- 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/src/Umbraco.Core/Services/Implement/ContentService.cs b/src/Umbraco.Core/Services/Implement/ContentService.cs index 559faf61e5e0..b190e0c69a00 100644 --- a/src/Umbraco.Core/Services/Implement/ContentService.cs +++ b/src/Umbraco.Core/Services/Implement/ContentService.cs @@ -2200,7 +2200,7 @@ public IContent Copy(IContent content, int parentId, bool relateToOriginal, bool var total = long.MaxValue; while (page * pageSize < total) { - var descendants = GetPagedDescendants(content.Id, page++, pageSize, out total, ordering: Ordering.By("sortOrder")); + var descendants = GetPagedDescendants(content.Id, page++, pageSize, out total); foreach (var descendant in descendants) { // if parent has not been copied, skip, else gets its copy id diff --git a/src/Umbraco.Tests/Services/ContentServiceTests.cs b/src/Umbraco.Tests/Services/ContentServiceTests.cs index 5af4bf6c977a..041dabe7d2fa 100644 --- a/src/Umbraco.Tests/Services/ContentServiceTests.cs +++ b/src/Umbraco.Tests/Services/ContentServiceTests.cs @@ -1959,33 +1959,6 @@ public void Can_Copy_Recursive() Assert.AreNotEqual(childCopy.Key, child.Key); } - - [Test] - public void Copy_Recursive_Preserves_Sort_Order() - { - // Arrange - var contentService = ServiceContext.ContentService; - var temp = contentService.GetById(NodeDto.NodeIdSeed + 2); - Assert.AreEqual("Home", temp.Name); - Assert.AreEqual(2, contentService.CountChildren(temp.Id)); - var reversedChildren = contentService.GetPagedChildren(temp.Id, 0, 10, out var total1).Reverse().ToArray(); - contentService.Sort(reversedChildren); - - // Act - var copy = contentService.Copy(temp, temp.ParentId, false, true, Constants.Security.SuperUserId); - var content = contentService.GetById(NodeDto.NodeIdSeed + 2); - - // Assert - Assert.That(copy, Is.Not.Null); - Assert.That(copy.Id, Is.Not.EqualTo(content.Id)); - Assert.AreNotSame(content, copy); - Assert.AreEqual(2, contentService.CountChildren(copy.Id)); - - var copiedChildren = contentService.GetPagedChildren(copy.Id, 0, 10, out var total2).OrderBy(c => c.SortOrder).ToArray(); - Assert.AreEqual(reversedChildren.First().Name, copiedChildren.First().Name); - Assert.AreEqual(reversedChildren.Last().Name, copiedChildren.Last().Name); - } - [Test] public void Can_Copy_NonRecursive() {