Update Boards::Lists::DestroyService to remove list on a specic board

parent 723ed9cc
...@@ -4,6 +4,8 @@ module Boards ...@@ -4,6 +4,8 @@ module Boards
def execute(list) def execute(list)
return false unless list.destroyable? return false unless list.destroyable?
@board = list.board
list.with_lock do list.with_lock do
decrement_higher_lists(list) decrement_higher_lists(list)
remove_list(list) remove_list(list)
...@@ -12,6 +14,8 @@ module Boards ...@@ -12,6 +14,8 @@ module Boards
private private
attr_reader :board
def decrement_higher_lists(list) def decrement_higher_lists(list)
board.lists.movable.where('position > ?', list.position) board.lists.movable.where('position > ?', list.position)
.update_all('position = position - 1') .update_all('position = position - 1')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment