U4-2069 - Delete of media, doesnt delete decendants first

Created by Anders Brannmark 08 Apr 2013, 10:09:05 Updated by Morten Christensen 20 Apr 2013, 13:06:18

When deleteing a media item from trashbin doesnt delete any decenants first, code from delete method in MediaService:

using (var repository = _repositoryFactory.CreateMediaRepository(uow)) { repository.Delete(media); uow.Commit(); }

Should do like ContentService: //Delete children before deleting the 'possible parent' var children = GetChildren(content.Id); foreach (var child in children) { Delete(child, userId); }

Comments

esunxray 14 Apr 2013, 14:32:26

I'm not a programmer, but I think the logic should like this: Delete one node only when it has not children nodes. void DeleteSomeOne(content.Id) { if(GetChildren(content.Id).Count==0) //test if it has children nodes? {Delete(currentContent);} else{ foreach (var child in children) { Delete(child, userId); } } }


Priority: Normal

Type: Bug

State: Fixed

Assignee: Morten Christensen

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 6.0.3

Due in version: 6.0.4

Sprint:

Story Points:

Cycle: