diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-10-05 14:00:18 -0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-10-11 11:39:04 -0300 |
commit | 9110746370c9759402af5087a612cbcfdf667c3c (patch) | |
tree | 2de249d7b6605938baf1faefa389c729f71f6ef8 /app | |
parent | a2c485473a142a5aad2f03abefb4bfafed645995 (diff) | |
download | gitlab-ce-9110746370c9759402af5087a612cbcfdf667c3c.tar.gz |
Update Boards::Lists::CreateService to create lists for a specific board
Diffstat (limited to 'app')
-rw-r--r-- | app/services/boards/base_service.rb | 1 | ||||
-rw-r--r-- | app/services/boards/lists/create_service.rb | 10 |
2 files changed, 5 insertions, 6 deletions
diff --git a/app/services/boards/base_service.rb b/app/services/boards/base_service.rb index b2069ca825a..7eacacbaf7e 100644 --- a/app/services/boards/base_service.rb +++ b/app/services/boards/base_service.rb @@ -1,5 +1,4 @@ module Boards class BaseService < ::BaseService - delegate :board, to: :project end end diff --git a/app/services/boards/lists/create_service.rb b/app/services/boards/lists/create_service.rb index b1887820bd4..da6f59c0399 100644 --- a/app/services/boards/lists/create_service.rb +++ b/app/services/boards/lists/create_service.rb @@ -1,23 +1,23 @@ module Boards module Lists class CreateService < Boards::BaseService - def execute + def execute(board) List.transaction do label = project.labels.find(params[:label_id]) - position = next_position + position = next_position(board) - create_list(label, position) + create_list(board, label, position) end end private - def next_position + def next_position(board) max_position = board.lists.movable.maximum(:position) max_position.nil? ? 0 : max_position.succ end - def create_list(label, position) + def create_list(board, label, position) board.lists.create(label: label, list_type: :label, position: position) end end |