Merge branch 'v10/dev' into v11/dev

This commit is contained in:
Sebastiaan Janssen
2022-09-20 09:13:22 +02:00
68 changed files with 1002 additions and 720 deletions

View File

@@ -383,6 +383,30 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
}
}
public IActionResult PostCopy(MoveOrCopy copy)
{
var toCopy = _dataTypeService.GetDataType(copy.Id);
if (toCopy is null)
{
return NotFound();
}
Attempt<OperationResult<MoveOperationStatusType, IDataType>?> result = _dataTypeService.Copy(toCopy, copy.ParentId);
if (result.Success)
{
return Content(toCopy.Path, MediaTypeNames.Text.Plain, Encoding.UTF8);
}
return result.Result?.Result switch
{
MoveOperationStatusType.FailedParentNotFound => NotFound(),
MoveOperationStatusType.FailedCancelledByEvent => ValidationProblem(),
MoveOperationStatusType.FailedNotAllowedByPath => ValidationProblem(
_localizedTextService.Localize("moveOrCopy", "notAllowedByPath")),
_ => throw new ArgumentOutOfRangeException()
};
}
public IActionResult PostRenameContainer(int id, string name)
{
var currentUser = _backOfficeSecurityAccessor.BackOfficeSecurity?.CurrentUser;

View File

@@ -260,6 +260,11 @@ public class DictionaryController : BackOfficeNotificationsController
return ValidationProblem(_localizedTextService.Localize("dictionary", "itemDoesNotExists"));
}
if(dictionaryItem.ParentId == null && move.ParentId == Constants.System.Root)
{
return ValidationProblem(_localizedTextService.Localize("moveOrCopy", "notAllowedByPath"));
}
IDictionaryItem? parent = _localizationService.GetDictionaryItemById(move.ParentId);
if (parent == null)
{
@@ -274,6 +279,11 @@ public class DictionaryController : BackOfficeNotificationsController
}
else
{
if (dictionaryItem.ParentId == parent.Key)
{
return ValidationProblem(_localizedTextService.Localize("moveOrCopy", "notAllowedByPath"));
}
dictionaryItem.ParentId = parent.Key;
if (dictionaryItem.Key == parent.ParentId)
{

View File

@@ -34,7 +34,8 @@ public class PublishedSnapshotCacheStatusController : UmbracoAuthorizedApiContro
[HttpPost]
public string RebuildDbCache()
{
_publishedSnapshotService.Rebuild();
//Rebuild All
_publishedSnapshotService.RebuildAll();
return _publishedSnapshotStatus.GetStatus();
}