diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
commit | 4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch) | |
tree | 5423a1c7516cffe36384133ade12572cf709398d /app/services/boards/lists/destroy_service.rb | |
parent | e570267f2f6b326480d284e0164a6464ba4081bc (diff) |
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'app/services/boards/lists/destroy_service.rb')
-rw-r--r-- | app/services/boards/lists/destroy_service.rb | 32 |
1 files changed, 2 insertions, 30 deletions
diff --git a/app/services/boards/lists/destroy_service.rb b/app/services/boards/lists/destroy_service.rb index ebac0f07fe1..10d9f275d3f 100644 --- a/app/services/boards/lists/destroy_service.rb +++ b/app/services/boards/lists/destroy_service.rb @@ -2,36 +2,8 @@ module Boards module Lists - class DestroyService < Boards::BaseService - def execute(list) - unless list.destroyable? - return ServiceResponse.error(message: "The list cannot be destroyed. Only label lists can be destroyed.") - end - - @board = list.board - - list.with_lock do - decrement_higher_lists(list) - remove_list(list) - end - - ServiceResponse.success - end - - private - - attr_reader :board - - # rubocop: disable CodeReuse/ActiveRecord - def decrement_higher_lists(list) - board.lists.movable.where('position > ?', list.position) - .update_all('position = position - 1') - end - # rubocop: enable CodeReuse/ActiveRecord - - def remove_list(list) - list.destroy! - end + # overridden in EE for board lists and also for epic board lists. + class DestroyService < Boards::Lists::BaseDestroyService end end end |