Inherit board related services from BaseService

parent 50ac488c
module Boards
class BaseService
def initialize(project, user, params = {})
@project = project
@board = project.board
@user = user
@params = params.dup
end
private
attr_reader :project, :board, :user, :params
class BaseService < ::BaseService
delegate :board, to: :project
end
end
......@@ -2,7 +2,7 @@ module Boards
module Issues
class ListService < Boards::BaseService
def execute
issues = IssuesFinder.new(user, filter_params).execute
issues = IssuesFinder.new(current_user, filter_params).execute
issues = without_board_labels(issues) unless list.movable?
issues = with_list_label(issues) if list.movable?
issues
......
......@@ -2,7 +2,7 @@ module Boards
module Issues
class MoveService < Boards::BaseService
def execute(issue)
return false unless user.can?(:update_issue, issue)
return false unless can?(current_user, :update_issue, issue)
return false unless valid_move?
update_service.execute(issue)
......@@ -23,7 +23,7 @@ module Boards
end
def update_service
::Issues::UpdateService.new(project, user, issue_params)
::Issues::UpdateService.new(project, current_user, issue_params)
end
def issue_params
......
......@@ -15,7 +15,7 @@ module Boards
def create_list(params)
label = find_or_create_label(params)
Lists::CreateService.new(project, user, label_id: label.id).execute
Lists::CreateService.new(project, current_user, label_id: label.id).execute
end
def find_or_create_label(params)
......
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