GitLab steht wegen Wartungsarbeiten am Montag, den 10. Mai, zwischen 17:00 und 19:00 Uhr nicht zur Verfügung.

Extract new list position validation to a method

parent 22b8c0b7
......@@ -8,10 +8,7 @@ def initialize(project, params = {})
def execute
return false unless list.label?
return false if new_position.blank?
return false if new_position == old_position
return false if new_position == first_position
return false if new_position == last_position
return false if invalid_position?
list.with_lock do
reorder_intermediate_lists
......@@ -27,6 +24,12 @@ def list
@list ||= board.lists.find(params[:list_id])
end
def invalid_position?
return true if new_position.blank?
[old_position, first_position, last_position].include?(new_position)
end
def first_position
board.lists.first.try(:position)
end
......
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