Commit 31f77568 authored by Bob Van Landuyt's avatar Bob Van Landuyt

`current_user:` as a keyword argument

parent e3daa73f
......@@ -118,7 +118,9 @@ class GroupsController < Groups::ApplicationController
protected
def setup_children(parent)
@children = GroupChildrenFinder.new(current_user, parent_group: parent, params: params).execute
@children = GroupChildrenFinder.new(current_user: current_user,
parent_group: parent,
params: params).execute
@children = @children.page(params[:page])
end
......
......@@ -3,7 +3,7 @@ class GroupChildrenFinder
attr_reader :current_user, :parent_group, :params
def initialize(current_user = nil, parent_group:, params: {})
def initialize(current_user: nil, parent_group:, params: {})
@current_user = current_user
@parent_group = parent_group
@params = params
......
......@@ -55,7 +55,8 @@ class GroupChildEntity < Grape::Entity
unless: lambda { |_instance, _options| project? }
def children_finder
@children_finder ||= GroupChildrenFinder.new(request.current_user, parent_group: object)
@children_finder ||= GroupChildrenFinder.new(current_user: request.current_user,
parent_group: object)
end
def children_count
......
......@@ -4,7 +4,9 @@ describe GroupChildrenFinder do
let(:user) { create(:user) }
let(:group) { create(:group) }
let(:params) { {} }
subject(:finder) { described_class.new(user, parent_group: group, params: params) }
subject(:finder) do
described_class.new(current_user: user, parent_group: group, params: params)
end
before do
group.add_owner(user)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment