From 9febbc7db189d297a2b6a2fc6cb695982c908ea7 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 8bdaba271e..59656de6b5 100644 --- a/src/Umbraco.Core/Services/ContentService.cs +++ b/src/Umbraco.Core/Services/ContentService.cs @@ -2760,6 +2760,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 3951ffba69..90c12c994a 100644 --- a/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DocumentRepository.cs +++ b/src/Umbraco.Infrastructure/Persistence/Repositories/Implement/DocumentRepository.cs @@ -900,9 +900,10 @@ public class DocumentRepository : ContentRepositoryBase