Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-12-22 14:49:56 +0300
committerDouwe Maan <douwe@selenight.nl>2017-12-22 20:07:15 +0300
commit771bf9527ffd5fd8fe258381593f686d5d960a42 (patch)
treee15ff12e3419aa751e3d54e6af7823a88f7be930 /app/models/diff_note.rb
parent92e15071c13f65cf7250315f1a138284880b0074 (diff)
Improve performance of DiffDiscussion#truncated_diff_lines and DiffNote#diff_line by removing expensive diff position calculation and comparison
Diffstat (limited to 'app/models/diff_note.rb')
-rw-r--r--app/models/diff_note.rb6
1 files changed, 1 insertions, 5 deletions
diff --git a/app/models/diff_note.rb b/app/models/diff_note.rb
index b53d44cda95..15122cbc693 100644
--- a/app/models/diff_note.rb
+++ b/app/models/diff_note.rb
@@ -21,7 +21,7 @@ class DiffNote < Note
before_validation :set_original_position, on: :create
before_validation :update_position, on: :create, if: :on_text?
- before_validation :set_line_code
+ before_validation :set_line_code, if: :on_text?
after_save :keep_around_commits
def discussion_class(*)
@@ -61,10 +61,6 @@ class DiffNote < Note
@diff_line ||= diff_file&.line_for_position(self.original_position)
end
- def for_line?(line)
- diff_file.position(line) == self.original_position
- end
-
def original_line_code
return unless on_text?