mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
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);
|
sub.setCategory(null);
|
||||||
}
|
}
|
||||||
feedSubscriptionDAO.update(subs);
|
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);
|
feedCategoryDAO.delete(cat);
|
||||||
return Response.ok().build();
|
return Response.ok().build();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user