diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 11:59:07 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 11:59:07 +0000 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /lib/api/boards_responses.rb | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) | |
download | gitlab-ce-8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca.tar.gz |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'lib/api/boards_responses.rb')
-rw-r--r-- | lib/api/boards_responses.rb | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/lib/api/boards_responses.rb b/lib/api/boards_responses.rb index 2ae82f78e01..89355c84401 100644 --- a/lib/api/boards_responses.rb +++ b/lib/api/boards_responses.rb @@ -45,21 +45,17 @@ module API def create_list create_list_service = - ::Boards::Lists::CreateService.new(board_parent, current_user, create_list_params) + ::Boards::Lists::CreateService.new(board_parent, current_user, declared_params.compact.with_indifferent_access) - list = create_list_service.execute(board) + response = create_list_service.execute(board) - if list.valid? - present list, with: Entities::List + if response.success? + present response.payload[:list], with: Entities::List else - render_validation_error!(list) + render_api_error!({ error: response.errors.first }, 400) end end - def create_list_params - params.slice(:label_id) - end - def move_list(list) move_list_service = ::Boards::Lists::MoveService.new(board_parent, current_user, { position: params[:position].to_i }) @@ -80,14 +76,6 @@ module API end end - # rubocop: disable CodeReuse/ActiveRecord - def authorize_list_type_resource! - unless available_labels_for(board_parent).exists?(params[:label_id]) - render_api_error!({ error: 'Label not found!' }, 400) - end - end - # rubocop: enable CodeReuse/ActiveRecord - params :list_creation_params do requires :label_id, type: Integer, desc: 'The ID of an existing label' end |