V15: Implement sorting for the in-memory navigation structures (document and media) (#17280)

* bump version to 15.1.0

* V15 Fixed the failing smoke tests in the pipeline v15 (#17158)

* Fixed the failing tests of Member Group due to UI changes

* Fixed the failing tests of Member due to UI changes

* Fixed the failing tests of User due to UI changes

* Fixed failing tests for Dictionary and Document Type

* Updated tests due to test helper changes

* Bumped version

* Updated assert steps due to the response changes

* Updated tests due to api helper changes

* Updated tests due to UI changes

* Fixed tests for delete partial view

* Fixed tests

* Added more waits

* Updated assert steps

* Fixed failing tests for Block Grid and Media

* Added more waits

* Added skip tests

* Removed waits time

* Updated assertion steps for User

* Added todo

* Updated tests due to api helper changes

* Bumped version

* Added skip tests

* Fetch sortOrder for each navigationNode

* Update NavigationNode to have sortOrder and change Parent and Children props to keys instead of NavigationNodes

* Consider sortOrder when building the navigation structures

* Renaming tests

* Adding tests for items being the last in structure when added, moved, etc.

* Updating names

* Cleanup

* Updating cache refreshers with changes due to sorting

* Refactoring due to sorting changes and resolving key to NavigationNode

* Removing sortOrder params from test as they are calculated automatically

* Adding content and media integration tests to test sorting functionality

* Adding sortOrder param for special case when adding new nodes

* Adding new UpdateSortOrder to INavigationManagementService

* Revert "V15 Fixed the failing smoke tests in the pipeline v15 (#17158)"

This reverts commit 31399c3b15.

* Revert "bump version to 15.1.0"

This reverts commit 5e4d15be

* Fix revert

* Add sort order when creating media

---------

Co-authored-by: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com>
Co-authored-by: Nhu Dinh <150406148+nhudinh0309@users.noreply.github.com>
Co-authored-by: Bjarke Berg <mail@bergmania.dk>
This commit is contained in:
Elitsa Marinovska
2024-10-16 10:51:42 +03:00
committed by GitHub
parent 86557a01cf
commit 44ff8dc5e1
24 changed files with 1186 additions and 93 deletions

View File

@@ -1,5 +1,3 @@
using Microsoft.Extensions.DependencyInjection;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Notifications;
@@ -199,7 +197,7 @@ public sealed class ContentCacheRefresher : PayloadCacheRefresherBase<ContentCac
// First creation
if (ExistsInNavigation(content.Key) is false && ExistsInNavigationBin(content.Key) is false)
{
_documentNavigationManagementService.Add(content.Key, GetParentKey(content));
_documentNavigationManagementService.Add(content.Key, GetParentKey(content), content.SortOrder);
if (content.Trashed)
{
// If created as trashed, move to bin
@@ -215,14 +213,20 @@ public sealed class ContentCacheRefresher : PayloadCacheRefresherBase<ContentCac
}
else
{
// It must have been saved. Check if parent is different
if (_documentNavigationQueryService.TryGetParentKey(content.Key, out var oldParentKey))
if (_documentNavigationQueryService.TryGetParentKey(content.Key, out Guid? oldParentKey) is false)
{
Guid? newParentKey = GetParentKey(content);
if (oldParentKey != newParentKey)
{
_documentNavigationManagementService.Move(content.Key, newParentKey);
}
return;
}
// It must have been saved. Check if parent is different
Guid? newParentKey = GetParentKey(content);
if (oldParentKey != newParentKey)
{
_documentNavigationManagementService.Move(content.Key, newParentKey);
}
else
{
_documentNavigationManagementService.UpdateSortOrder(content.Key, content.SortOrder);
}
}
}