Commit a1d42a79 authored by Kamil Trzciński's avatar Kamil Trzciński

Accept line_code and position when importing

parent 83c2d05b
......@@ -5,7 +5,7 @@ module DiffPositionableNote
included do
delegate :on_text?, :on_image?, to: :position, allow_nil: true
before_validation :set_original_position, on: :create
before_validation :update_position, on: :create, if: :on_text?
before_validation :update_position, on: :create, if: :on_text?, unless: :importing?
serialize :original_position, Gitlab::Diff::Position # rubocop:disable Cop/ActiveRecordSerialize
serialize :position, Gitlab::Diff::Position # rubocop:disable Cop/ActiveRecordSerialize
......
......@@ -21,7 +21,7 @@ class DiffNote < Note
validate :positions_complete
validate :verify_supported
before_validation :set_line_code, if: :on_text?
before_validation :set_line_code, if: :on_text?, unless: :importing?
after_save :keep_around_commits, unless: :importing?
after_commit :create_diff_file, on: :create
......@@ -104,7 +104,7 @@ class DiffNote < Note
end
def should_create_diff_file?
false && on_text? && note_diff_file.nil? && start_of_discussion?
on_text? && note_diff_file.nil? && start_of_discussion?
end
def fetch_diff_file
......
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