forked from Archives/Athou_commafeed
set parent category of children categories to null when removing a category (fix #38)
This commit is contained in:
@@ -210,6 +210,16 @@ public class CategoryREST extends AbstractResourceREST {
|
||||
sub.setCategory(null);
|
||||
}
|
||||
feedSubscriptionDAO.update(subs);
|
||||
List<FeedCategory> categories = feedCategoryDAO
|
||||
.findAllChildrenCategories(getUser(), cat);
|
||||
for (FeedCategory child : categories) {
|
||||
if (!child.getId().equals(cat.getId())
|
||||
&& child.getParent().getId().equals(cat.getId())) {
|
||||
child.setParent(null);
|
||||
}
|
||||
}
|
||||
feedCategoryDAO.update(categories);
|
||||
|
||||
feedCategoryDAO.delete(cat);
|
||||
return Response.ok().build();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user