No longer shows success message if content moving is cancelled (#15051)

* Fix for issue https://github.com/umbraco/Umbraco-CMS/issues/13923
 - Added AttemptMove method to the ContentService
 - Updated ContentController PostMove method to return ValidationProblem whenever the node is not moved

* Align changes with V14 solution. Make it non breaking.

---------

Co-authored-by: Laura Neto <12862535+lauraneto@users.noreply.github.com>
This commit is contained in:
Miguel Pinto
2024-09-05 14:08:48 +02:00
committed by GitHub
parent bff293213d
commit 3e6116fcba
3 changed files with 35 additions and 8 deletions

View File

@@ -2254,7 +2254,12 @@ public class ContentController : ContentControllerBase
return null;
}
_contentService.Move(toMove, move.ParentId, _backofficeSecurityAccessor.BackOfficeSecurity?.GetUserId().Result ?? -1);
OperationResult moveResult = _contentService.AttemptMove(toMove, move.ParentId, _backofficeSecurityAccessor.BackOfficeSecurity?.GetUserId().Result ?? -1);
if (!moveResult.Success)
{
return ValidationProblem();
}
return Content(toMove.Path, MediaTypeNames.Text.Plain, Encoding.UTF8);
}