Adds updating of SortOrder upon moving a document.
Related to U4-1461
This commit is contained in:
@@ -280,6 +280,8 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
{
|
||||
var parent = Database.First<NodeDto>("WHERE id = @ParentId", new { ParentId = entity.ParentId });
|
||||
entity.Path = string.Concat(parent.Path, ",", entity.Id);
|
||||
var maxSortOrder = Database.ExecuteScalar<int>("SELECT coalesce(max(sortOrder),0) FROM umbracoNode WHERE parentid = @ParentId", new { ParentId = entity.ParentId });
|
||||
entity.SortOrder = maxSortOrder;
|
||||
}
|
||||
|
||||
var factory = new ContentFactory(NodeObjectTypeId, entity.Id);
|
||||
|
||||
@@ -905,9 +905,13 @@ namespace Umbraco.Core.Services
|
||||
/// <param name="userId">Optional Id of the User moving the Content</param>
|
||||
public void Move(IContent content, int parentId, int userId = -1)
|
||||
{
|
||||
//TODO Verify that SortOrder + Path is updated correctly
|
||||
//TODO Add a check to see if parentId = -20 because then we should change the TrashState
|
||||
|
||||
//This ensures that the correct method is called if this method is used to Move to recycle bin.
|
||||
if (parentId == -20)
|
||||
{
|
||||
MoveToRecycleBin(content, userId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Moving.IsRaisedEventCancelled(new MoveEventArgs<IContent>(content, parentId), this))
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user