Skip to content
Snippets Groups Projects
Commit 31f77568 authored by Bob Van Landuyt's avatar Bob Van Landuyt
Browse files

`current_user:` as a keyword argument

parent e3daa73f
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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
 
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment