From 6971ded138fa430acf3fcb500aaec357bb632c18 Mon Sep 17 00:00:00 2001 From: Sven Geusens Date: Thu, 21 Nov 2024 09:07:22 +0100 Subject: [PATCH] Distinguish between default zero and intentional zero sort order for new documents (#17517) * Distinguish between default value and initial zero * Update special value comment documentation * Redid solution with dirty/new entity tracking * rework copy branch sortorder fix * Change == false to is false --------- Co-authored-by: Mole --- src/Umbraco.Core/Services/ContentService.cs | 3 +++ .../Persistence/Repositories/Implement/DocumentRepository.cs | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Core/Services/ContentService.cs b/src/Umbraco.Core/Services/ContentService.cs index 08147a48a9..473de72a76 100644 --- a/src/Umbraco.Core/Services/ContentService.cs +++ b/src/Umbraco.Core/Services/ContentService.cs @@ -2772,6 +2772,9 @@ public class ContentService : RepositoryService, IContentService descendantCopy.CreatorId = userId; descendantCopy.WriterId = userId; + // since the repository relies on the dirty state to figure out whether it needs to update the sort order, we mark it dirty here + descendantCopy.SortOrder = descendantCopy.SortOrder; + // save and flush (see above) _documentRepository.Save(descendantCopy); diff --git a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DocumentRepository.cs b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DocumentRepository.cs index 5c11e512f1..2a80dde09a 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DocumentRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DocumentRepository.cs @@ -916,9 +916,10 @@ public class DocumentRepository : ContentRepositoryBase