diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-10-06 23:13:33 +0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-10-11 17:39:05 +0300 |
commit | 2c2a1dea67ef41a6e283c4816865645fba318a16 (patch) | |
tree | aed3dd76703c889ae2afaf525142af74732fb686 /app/services | |
parent | 81c253ded12c96bfa3f5cf27f0e23c61619ad914 (diff) |
Refactoring service to create a new issue in a board list
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/boards/issues/create_service.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/app/services/boards/issues/create_service.rb b/app/services/boards/issues/create_service.rb index 3701afd441f..a181e74043b 100644 --- a/app/services/boards/issues/create_service.rb +++ b/app/services/boards/issues/create_service.rb @@ -1,14 +1,21 @@ module Boards module Issues class CreateService < Boards::BaseService - def execute(list) - params.merge!(label_ids: [list.label_id]) - create_issue + def execute + create_issue(params.merge(label_ids: [list.label_id])) end private - def create_issue + def board + @board ||= project.boards.find(params.delete(:board_id)) + end + + def list + @list ||= board.lists.find(params.delete(:list_id)) + end + + def create_issue(params) ::Issues::CreateService.new(project, current_user, params).execute end end |