diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-08-16 19:47:55 -0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-08-17 12:58:59 -0300 |
commit | 4de6799ef5a0435a775e5e945faad4dc7937ca6c (patch) | |
tree | b184e0f5660419451dd96dd68cea16752e58679b /app/services/boards | |
parent | 50ac488c739718902ba897bc5ad8791d35914324 (diff) | |
download | gitlab-ce-4de6799ef5a0435a775e5e945faad4dc7937ca6c.tar.gz |
Inherit board related services from BaseService
Diffstat (limited to 'app/services/boards')
-rw-r--r-- | app/services/boards/base_service.rb | 13 | ||||
-rw-r--r-- | app/services/boards/issues/list_service.rb | 2 | ||||
-rw-r--r-- | app/services/boards/issues/move_service.rb | 4 | ||||
-rw-r--r-- | app/services/boards/lists/generate_service.rb | 2 |
4 files changed, 6 insertions, 15 deletions
diff --git a/app/services/boards/base_service.rb b/app/services/boards/base_service.rb index e2d2bdfe3d7..b2069ca825a 100644 --- a/app/services/boards/base_service.rb +++ b/app/services/boards/base_service.rb @@ -1,14 +1,5 @@ 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 diff --git a/app/services/boards/issues/list_service.rb b/app/services/boards/issues/list_service.rb index c2130273c0c..435a8c6e681 100644 --- a/app/services/boards/issues/list_service.rb +++ b/app/services/boards/issues/list_service.rb @@ -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 diff --git a/app/services/boards/issues/move_service.rb b/app/services/boards/issues/move_service.rb index 71f463bad30..d6eb4adc5dd 100644 --- a/app/services/boards/issues/move_service.rb +++ b/app/services/boards/issues/move_service.rb @@ -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 diff --git a/app/services/boards/lists/generate_service.rb b/app/services/boards/lists/generate_service.rb index 86f0aa99c61..1c48b9786e4 100644 --- a/app/services/boards/lists/generate_service.rb +++ b/app/services/boards/lists/generate_service.rb @@ -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) |