diff options
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 |