summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-03-09 08:53:47 +0000
committerPhil Hughes <me@iamphill.com>2017-03-09 08:53:47 +0000
commit789bae241cab6fdab00fb8ef632e7e1c9dd34025 (patch)
tree654aeffad06602c656cd18bb02fd50c48971f44f
parent72e940df2c24ab80056dfe296011c7a44ebdf3f0 (diff)
downloadgitlab-ce-789bae241cab6fdab00fb8ef632e7e1c9dd34025.tar.gz
Fixed bugs with diff comment avatars
The comment button on commit view was way out to the left side because the element that renders the diff avatars was rendering when it shouldnt be When commenting on a discussion on the discussions tab it would try to render the avatar & in some cases work correctly even though it shouldnt be possible for this to happen. Changed the if statement to take this into account Closes #29237, #29238, #29243
-rw-r--r--app/views/projects/diffs/_line.html.haml5
-rw-r--r--app/views/projects/diffs/_parallel_view.html.haml4
2 files changed, 5 insertions, 4 deletions
diff --git a/app/views/projects/diffs/_line.html.haml b/app/views/projects/diffs/_line.html.haml
index ed279cfe168..b40d9cb928b 100644
--- a/app/views/projects/diffs/_line.html.haml
+++ b/app/views/projects/diffs/_line.html.haml
@@ -5,6 +5,7 @@
- line_code = diff_file.line_code(line)
- if discussions && !line.meta?
- discussion = discussions[line_code]
+ - show_discussion_avatars = discussion && discussion.resolvable? && !plain
%tr.line_holder{ class: type, id: (line_code unless plain) }
- case type
- when 'match'
@@ -14,13 +15,13 @@
%td.new_line.diff-line-num
%td.line_content.match= line.text
- else
- %td.old_line.diff-line-num.js-avatar-container{ class: type, data: { linenumber: line.old_pos } }
+ %td.old_line.diff-line-num{ class: [type, ("js-avatar-container" if show_discussion_avatars)], data: { linenumber: line.old_pos } }
- link_text = type == "new" ? " " : line.old_pos
- if plain
= link_text
- else
%a{ href: "##{line_code}", data: { linenumber: link_text } }
- - if discussion && !plain
+ - if show_discussion_avatars
%diff-note-avatars{ "discussion-id" => discussion.id }
%td.new_line.diff-line-num{ class: type, data: { linenumber: line.new_pos } }
- link_text = type == "old" ? " " : line.new_pos
diff --git a/app/views/projects/diffs/_parallel_view.html.haml b/app/views/projects/diffs/_parallel_view.html.haml
index 6448748113b..e7758c8bdfa 100644
--- a/app/views/projects/diffs/_parallel_view.html.haml
+++ b/app/views/projects/diffs/_parallel_view.html.haml
@@ -20,7 +20,7 @@
- left_position = diff_file.position(left)
%td.old_line.diff-line-num.js-avatar-container{ id: left_line_code, class: left.type, data: { linenumber: left.old_pos } }
%a{ href: "##{left_line_code}", data: { linenumber: left.old_pos } }
- - if discussion_left
+ - if discussion_left && discussion_left.resolvable?
%diff-note-avatars{ "discussion-id" => discussion_left.id }
%td.line_content.parallel.noteable_line{ class: left.type, data: diff_view_line_data(left_line_code, left_position, 'old') }= diff_line_content(left.text)
- else
@@ -39,7 +39,7 @@
- right_position = diff_file.position(right)
%td.new_line.diff-line-num.js-avatar-container{ id: right_line_code, class: right.type, data: { linenumber: right.new_pos } }
%a{ href: "##{right_line_code}", data: { linenumber: right.new_pos } }
- - if discussion_right
+ - if discussion_right && discussion_right.resolvable?
%diff-note-avatars{ "discussion-id" => discussion_right.id }
%td.line_content.parallel.noteable_line{ class: right.type, data: diff_view_line_data(right_line_code, right_position, 'new') }= diff_line_content(right.text)
- else