Skip to content
Snippets Groups Projects
Commit 080924f9 authored by Douwe Maan's avatar Douwe Maan
Browse files

Fix bug where notes weren’t shown in discussion when the code had changed after creation

parent 8d3ef366
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -17,6 +17,10 @@ module NoteOnDiff
raise NotImplementedError
end
 
def original_line_code
raise NotImplementedError
end
def diff_attributes
raise NotImplementedError
end
Loading
Loading
Loading
Loading
@@ -57,6 +57,10 @@ class DiffNote < Note
diff_file.position(line) == self.original_position
end
 
def original_line_code
self.diff_file.line_code(self.diff_line)
end
def active?(diff_refs = nil)
return false unless supported?
return true if for_commit?
Loading
Loading
Loading
Loading
@@ -12,6 +12,7 @@ class Discussion
:for_merge_request?,
 
:line_code,
:original_line_code,
:diff_file,
:for_line?,
:active?,
Loading
Loading
Loading
Loading
@@ -49,6 +49,10 @@ class LegacyDiffNote < Note
!line.meta? && diff_file.line_code(line) == self.line_code
end
 
def original_line_code
self.line_code
end
# Check if this note is part of an "active" discussion
#
# This will always return true for anything except MergeRequest noteables,
Loading
Loading
Loading
Loading
@@ -7,7 +7,7 @@
 
.diff-content.code.js-syntax-highlight
%table
- discussions = { discussion.line_code => discussion }
- discussions = { discussion.original_line_code => discussion }
= render partial: "projects/diffs/line",
collection: discussion.truncated_diff_lines,
as: :line,
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment