diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-12-22 14:49:56 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-12-22 20:07:15 +0300 |
commit | 771bf9527ffd5fd8fe258381593f686d5d960a42 (patch) | |
tree | e15ff12e3419aa751e3d54e6af7823a88f7be930 /app/models/legacy_diff_note.rb | |
parent | 92e15071c13f65cf7250315f1a138284880b0074 (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/legacy_diff_note.rb')
-rw-r--r-- | app/models/legacy_diff_note.rb | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/app/models/legacy_diff_note.rb b/app/models/legacy_diff_note.rb index c36be956ff0..d90cafd14b4 100644 --- a/app/models/legacy_diff_note.rb +++ b/app/models/legacy_diff_note.rb @@ -38,11 +38,7 @@ class LegacyDiffNote < Note end def diff_line - @diff_line ||= diff_file.line_for_line_code(self.line_code) if diff_file - end - - def for_line?(line) - line.discussable? && diff_file.line_code(line) == self.line_code + @diff_line ||= diff_file&.line_for_line_code(self.line_code) end def original_line_code |