Fixes U4-1619 so MediaTypes are deleted the same way as DocumentTypes using the legacy api/backoffice.
This commit is contained in:
@@ -358,7 +358,7 @@ namespace Umbraco.Core.Services
|
||||
if (DeletingMediaType.IsRaisedEventCancelled(new DeleteEventArgs<IMediaType>(mediaType), this))
|
||||
return;
|
||||
|
||||
_mediaService.DeleteMediaOfType(mediaType.Id);
|
||||
_mediaService.DeleteMediaOfType(mediaType.Id, userId);
|
||||
|
||||
var uow = _uowProvider.GetUnitOfWork();
|
||||
using (var repository = _repositoryFactory.CreateMediaTypeRepository(uow))
|
||||
|
||||
@@ -150,10 +150,13 @@ namespace umbraco.cms.businesslogic.media
|
||||
|
||||
if (!e.Cancel)
|
||||
{
|
||||
// delete all documents of this type
|
||||
Media.DeleteFromType(this);
|
||||
// Delete contentType
|
||||
base.delete();
|
||||
// check that no media types uses me as a master
|
||||
if (GetAllAsList().Any(dt => dt.MasterContentTypes.Contains(this.Id)))
|
||||
{
|
||||
throw new ArgumentException("Can't delete a Media Type used as a Master Content Type. Please remove all references first!");
|
||||
}
|
||||
|
||||
ApplicationContext.Current.Services.ContentTypeService.Delete(_mediaType);
|
||||
|
||||
FireAfterDelete(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user