Allow empty lines for current_content event
Fixes CODEOCEAN-VR
This commit is contained in:

committed by
Sebastian Serth

parent
8a5dc7abc0
commit
51fc44c2da
@ -34,7 +34,8 @@ class Event::SynchronizedEditor < ApplicationRecord
|
||||
validates :range_start_column, numericality: {only_integer: true, greater_than_or_equal_to: 0}, if: -> { action_editor_change? }
|
||||
validates :range_end_row, numericality: {only_integer: true, greater_than_or_equal_to: 0}, if: -> { action_editor_change? }
|
||||
validates :range_end_column, numericality: {only_integer: true, greater_than_or_equal_to: 0}, if: -> { action_editor_change? }
|
||||
validates :lines, presence: true, if: -> { action_editor_change? || action_current_content? }
|
||||
validates :lines, presence: true, if: -> { action_editor_change? }
|
||||
validate :lines_not_nil, if: -> { action_current_content? }
|
||||
|
||||
def self.create_for_editor_change(event, user, programming_group)
|
||||
event_copy = event.deep_dup
|
||||
@ -91,3 +92,11 @@ class Event::SynchronizedEditor < ApplicationRecord
|
||||
end
|
||||
private_class_method :data_attribute
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def lines_not_nil
|
||||
if lines.nil?
|
||||
errors.add(:lines, 'cannot be nil')
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user