Expose has_subgroups for groups endpoint

This is needed because we have to know before hand if the group has subgroups. If the group doesn’t have subgroups we will not let the user to click a group row to fetch subgroups, also we will hide caret icon which is used to indicate the row can be expanded.
This commit is contained in:
Alfredo Sumaran 2017-05-30 03:53:00 -05:00
parent 5e9378961f
commit fb1e7eae99
1 changed files with 4 additions and 0 deletions

View File

@ -26,4 +26,8 @@ class GroupEntity < Grape::Entity
expose :can_edit do |group|
can?(request.current_user, :admin_group, group)
end
expose :has_subgroups do |group|
group.children.any?
end
end