V8 Duplicate comments in MediaService (#5636)

* Remove duplicate comments in MediaService

* Remove temp files
This commit is contained in:
Steve Temple
2019-06-23 12:12:46 +01:00
committed by Sebastiaan Janssen
parent acf63fc74d
commit fafd045ed2

View File

@@ -201,7 +201,7 @@ namespace Umbraco.Core.Services.Implement
var mediaType = GetMediaType(mediaTypeAlias);
if (mediaType == null)
throw new ArgumentException("No media type with that alias.", nameof(mediaTypeAlias)); // causes rollback // causes rollback
throw new ArgumentException("No media type with that alias.", nameof(mediaTypeAlias)); // causes rollback
var media = new Models.Media(name, parent, mediaType);
CreateMedia(scope, media, parent, userId, false);
@@ -227,13 +227,13 @@ namespace Umbraco.Core.Services.Implement
// locking the media tree secures media types too
scope.WriteLock(Constants.Locks.MediaTree);
var mediaType = GetMediaType(mediaTypeAlias); // + locks // + locks
var mediaType = GetMediaType(mediaTypeAlias); // + locks
if (mediaType == null)
throw new ArgumentException("No media type with that alias.", nameof(mediaTypeAlias)); // causes rollback // causes rollback
throw new ArgumentException("No media type with that alias.", nameof(mediaTypeAlias)); // causes rollback
var parent = parentId > 0 ? GetById(parentId) : null; // + locks // + locks
var parent = parentId > 0 ? GetById(parentId) : null; // + locks
if (parentId > 0 && parent == null)
throw new ArgumentException("No media with that id.", nameof(parentId)); // causes rollback // causes rollback
throw new ArgumentException("No media with that id.", nameof(parentId)); // causes rollback
var media = parentId > 0 ? new Models.Media(name, parent, mediaType) : new Models.Media(name, parentId, mediaType);
CreateMedia(scope, media, parent, userId, true);
@@ -261,9 +261,9 @@ namespace Umbraco.Core.Services.Implement
// locking the media tree secures media types too
scope.WriteLock(Constants.Locks.MediaTree);
var mediaType = GetMediaType(mediaTypeAlias); // + locks // + locks
var mediaType = GetMediaType(mediaTypeAlias); // + locks
if (mediaType == null)
throw new ArgumentException("No media type with that alias.", nameof(mediaTypeAlias)); // causes rollback // causes rollback
throw new ArgumentException("No media type with that alias.", nameof(mediaTypeAlias)); // causes rollback
var media = new Models.Media(name, parent, mediaType);
CreateMedia(scope, media, parent, userId, true);
@@ -645,8 +645,6 @@ namespace Umbraco.Core.Services.Implement
}
// poor man's validation?
// poor man's validation?
if (string.IsNullOrWhiteSpace(media.Name))
throw new ArgumentException("Media has no name.", nameof(media));
@@ -934,7 +932,7 @@ namespace Umbraco.Core.Services.Implement
var parent = parentId == Constants.System.Root ? null : GetById(parentId);
if (parentId != Constants.System.Root && (parent == null || parent.Trashed))
throw new InvalidOperationException("Parent does not exist or is trashed."); // causes rollback // causes rollback
throw new InvalidOperationException("Parent does not exist or is trashed."); // causes rollback
var moveEventInfo = new MoveEventInfo<IMedia>(media, media.Path, parentId);
var moveEventArgs = new MoveEventArgs<IMedia>(true, evtMsgs, moveEventInfo);
@@ -947,12 +945,6 @@ namespace Umbraco.Core.Services.Implement
// if media was trashed, and since we're not moving to the recycle bin,
// indicate that the trashed status should be changed to false, else just
// leave it unchanged
// if media was trashed, and since we're not moving to the recycle bin,
// indicate that the trashed status should be changed to false, else just
// leave it unchanged
var trashed = media.Trashed ? false : (bool?) null;
PerformMoveLocked(media, parentId, parent, userId, moves, trashed);
@@ -1042,17 +1034,11 @@ namespace Umbraco.Core.Services.Implement
{
scope.WriteLock(Constants.Locks.MediaTree);
// no idea what those events are for, keep a simplified version
// v7 EmptyingRecycleBin and EmptiedRecycleBin events are greatly simplified since
// each deleted items will have its own deleting/deleted events. so, files and such
// are managed by Delete, and not here.
// no idea what those events are for, keep a simplified version
// v7 EmptyingRecycleBin and EmptiedRecycleBin events are greatly simplified since
// each deleted items will have its own deleting/deleted events. so, files and such
// emptying the recycle bin means deleting whatever is in there - do it properly!
// are managed by Delete, and not here.
// no idea what those events are for, keep a simplified version
var args = new RecycleBinEventArgs(nodeObjectType, evtMsgs);
if (scope.Events.DispatchCancelable(EmptyingRecycleBin, this, args))
@@ -1113,11 +1099,6 @@ namespace Umbraco.Core.Services.Implement
{
// if the current sort order equals that of the media we don't
// need to update it, so just increment the sort order and continue.
// if the current sort order equals that of the media we don't
// else update
// need to update it, so just increment the sort order and continue.
// save
if (media.SortOrder == sortOrder)
{
sortOrder++;