diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/finders/group_children_finder.rb | 4 | ||||
-rw-r--r-- | app/serializers/group_child_entity.rb | 8 |
2 files changed, 5 insertions, 7 deletions
diff --git a/app/finders/group_children_finder.rb b/app/finders/group_children_finder.rb index bac3fb208d0..07b97163c62 100644 --- a/app/finders/group_children_finder.rb +++ b/app/finders/group_children_finder.rb @@ -65,7 +65,7 @@ class GroupChildrenFinder base_groups end groups = groups - groups.sort(params[:sort]) + groups.sort(params[:sort]).includes(:route) end def base_projects @@ -86,6 +86,6 @@ class GroupChildrenFinder else base_projects end - projects.sort(params[:sort]) + projects.sort(params[:sort]).includes(:route, :namespace) end end diff --git a/app/serializers/group_child_entity.rb b/app/serializers/group_child_entity.rb index bc870541795..ab0d8a32312 100644 --- a/app/serializers/group_child_entity.rb +++ b/app/serializers/group_child_entity.rb @@ -32,11 +32,9 @@ class GroupChildEntity < Grape::Entity end def permission - if project? - object.project_members.find_by(user_id: request.current_user)&.human_access - else - object.group_members.find_by(user_id: request.current_user)&.human_access - end + return unless request&.current_user + + request.current_user.members.find_by(source: object)&.human_access end # Project only attributes |