diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-06-24 13:01:17 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-06-24 13:01:17 +0000 |
commit | 39c2099106b462ed20668b759181fc7d0b0a356c (patch) | |
tree | 94fae78bee6e82b52d2cdff9d7b7876e6984da7a | |
parent | 2d9667df264dae9a11fe58f8320a716d61e48e06 (diff) | |
parent | 8c67c339dc631a6458d87deed7ce011562bb5e2a (diff) | |
download | gitlab-ce-39c2099106b462ed20668b759181fc7d0b0a356c.tar.gz |
Merge branch 'fix-reply-button' into 'master'
Fix reply button
Don't show reply button if user is not signed in. Fixes #1360
5 files changed, 23 insertions, 15 deletions
diff --git a/app/helpers/notes_helper.rb b/app/helpers/notes_helper.rb index 9ed38ba84b2..da1969b344d 100644 --- a/app/helpers/notes_helper.rb +++ b/app/helpers/notes_helper.rb @@ -61,4 +61,23 @@ module NotesHelper link_to "", "javascript:;", class: "add-diff-note js-add-diff-note-button", data: data, title: "Add a comment to this line" 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 diff --git a/app/views/projects/notes/_diff_notes_with_reply.html.haml b/app/views/projects/notes/_diff_notes_with_reply.html.haml index 9acadc6a14e..6ec9169d432 100644 --- a/app/views/projects/notes/_diff_notes_with_reply.html.haml +++ b/app/views/projects/notes/_diff_notes_with_reply.html.haml @@ -9,5 +9,4 @@ %td.notes_content %ul.notes{ rel: note.discussion_id } = render notes - - = render "projects/notes/discussion_reply_button", note: note + = link_to_reply_diff(note) diff --git a/app/views/projects/notes/_diff_notes_with_reply_parallel.html.haml b/app/views/projects/notes/_diff_notes_with_reply_parallel.html.haml index 399ce30d1a9..02f189f7c5a 100644 --- a/app/views/projects/notes/_diff_notes_with_reply_parallel.html.haml +++ b/app/views/projects/notes/_diff_notes_with_reply_parallel.html.haml @@ -12,7 +12,7 @@ %ul.notes{ rel: note1.discussion_id } = render notes1 - = render "projects/notes/discussion_reply_button", note: note1 + = link_to_reply_diff(note1) - else %td= "" %td= "" @@ -26,7 +26,7 @@ %ul.notes{ rel: note2.discussion_id } = render notes2 - = render "projects/notes/discussion_reply_button", note: note2 + = link_to_reply_diff(note2) - else %td= "" %td= "" diff --git a/app/views/projects/notes/_discussion.html.haml b/app/views/projects/notes/_discussion.html.haml index 78793eb860f..b4bbfdc3f44 100644 --- a/app/views/projects/notes/_discussion.html.haml +++ b/app/views/projects/notes/_discussion.html.haml @@ -43,4 +43,4 @@ - else .notes{ rel: discussion_notes.first.discussion_id } = render discussion_notes - = render "projects/notes/discussion_reply_button", note: discussion_notes.first + = link_to_reply_diff(discussion_notes.first) diff --git a/app/views/projects/notes/_discussion_reply_button.html.haml b/app/views/projects/notes/_discussion_reply_button.html.haml deleted file mode 100644 index d1c5ccc29db..00000000000 --- a/app/views/projects/notes/_discussion_reply_button.html.haml +++ /dev/null @@ -1,10 +0,0 @@ -= 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 |