Commit 39c20991 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'fix-reply-button' into 'master'

Fix reply button

Don't show reply button if user is not signed in. Fixes #1360
parents 2d9667df 8c67c339
...@@ -61,4 +61,23 @@ module NotesHelper ...@@ -61,4 +61,23 @@ module NotesHelper
link_to "", "javascript:;", class: "add-diff-note js-add-diff-note-button", link_to "", "javascript:;", class: "add-diff-note js-add-diff-note-button",
data: data, title: "Add a comment to this line" data: data, title: "Add a comment to this line"
end end
def link_to_reply_diff(note)
return unless current_user
data = {
noteable_type: note.noteable_type,
noteable_id: note.noteable_id,
commit_id: note.commit_id,
line_code: note.line_code,
discussion_id: note.discussion_id
}
link_to "javascript:;", class: "btn reply-btn js-discussion-reply-button",
data: data, title: "Add a reply" do
link_text = ""
link_text < content_tag(:i, nil, class: 'icon-comment')
link_text << "Reply"
end
end
end end
...@@ -9,5 +9,4 @@ ...@@ -9,5 +9,4 @@
%td.notes_content %td.notes_content
%ul.notes{ rel: note.discussion_id } %ul.notes{ rel: note.discussion_id }
= render notes = render notes
= link_to_reply_diff(note)
= render "projects/notes/discussion_reply_button", note: note
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
%ul.notes{ rel: note1.discussion_id } %ul.notes{ rel: note1.discussion_id }
= render notes1 = render notes1
= render "projects/notes/discussion_reply_button", note: note1 = link_to_reply_diff(note1)
- else - else
%td= "" %td= ""
%td= "" %td= ""
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
%ul.notes{ rel: note2.discussion_id } %ul.notes{ rel: note2.discussion_id }
= render notes2 = render notes2
= render "projects/notes/discussion_reply_button", note: note2 = link_to_reply_diff(note2)
- else - else
%td= "" %td= ""
%td= "" %td= ""
......
...@@ -43,4 +43,4 @@ ...@@ -43,4 +43,4 @@
- else - else
.notes{ rel: discussion_notes.first.discussion_id } .notes{ rel: discussion_notes.first.discussion_id }
= render discussion_notes = render discussion_notes
= render "projects/notes/discussion_reply_button", note: discussion_notes.first = link_to_reply_diff(discussion_notes.first)
= link_to "javascript:;",
class: "btn reply-btn js-discussion-reply-button",
data: { noteable_type: note.noteable_type,
noteable_id: note.noteable_id,
commit_id: note.commit_id,
line_code: note.line_code,
discussion_id: note.discussion_id },
title: "Add a reply" do
%i.icon-comment
Reply
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment