Fix bug where notes weren’t shown in discussion when the code had changed after creation
This commit is contained in:
parent
8d3ef36622
commit
080924f979
5 changed files with 14 additions and 1 deletions
|
@ -17,6 +17,10 @@ module NoteOnDiff
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def original_line_code
|
||||||
|
raise NotImplementedError
|
||||||
|
end
|
||||||
|
|
||||||
def diff_attributes
|
def diff_attributes
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
end
|
end
|
||||||
|
|
|
@ -57,6 +57,10 @@ class DiffNote < Note
|
||||||
diff_file.position(line) == self.original_position
|
diff_file.position(line) == self.original_position
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def original_line_code
|
||||||
|
self.diff_file.line_code(self.diff_line)
|
||||||
|
end
|
||||||
|
|
||||||
def active?(diff_refs = nil)
|
def active?(diff_refs = nil)
|
||||||
return false unless supported?
|
return false unless supported?
|
||||||
return true if for_commit?
|
return true if for_commit?
|
||||||
|
|
|
@ -12,6 +12,7 @@ class Discussion
|
||||||
:for_merge_request?,
|
:for_merge_request?,
|
||||||
|
|
||||||
:line_code,
|
:line_code,
|
||||||
|
:original_line_code,
|
||||||
:diff_file,
|
:diff_file,
|
||||||
:for_line?,
|
:for_line?,
|
||||||
:active?,
|
:active?,
|
||||||
|
|
|
@ -49,6 +49,10 @@ class LegacyDiffNote < Note
|
||||||
!line.meta? && diff_file.line_code(line) == self.line_code
|
!line.meta? && diff_file.line_code(line) == self.line_code
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def original_line_code
|
||||||
|
self.line_code
|
||||||
|
end
|
||||||
|
|
||||||
# Check if this note is part of an "active" discussion
|
# Check if this note is part of an "active" discussion
|
||||||
#
|
#
|
||||||
# This will always return true for anything except MergeRequest noteables,
|
# This will always return true for anything except MergeRequest noteables,
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
.diff-content.code.js-syntax-highlight
|
.diff-content.code.js-syntax-highlight
|
||||||
%table
|
%table
|
||||||
- discussions = { discussion.line_code => discussion }
|
- discussions = { discussion.original_line_code => discussion }
|
||||||
= render partial: "projects/diffs/line",
|
= render partial: "projects/diffs/line",
|
||||||
collection: discussion.truncated_diff_lines,
|
collection: discussion.truncated_diff_lines,
|
||||||
as: :line,
|
as: :line,
|
||||||
|
|
Loading…
Reference in a new issue