Commit 725ff58b authored by Robert Speicher's avatar Robert Speicher

Don't add js-task-list-container to things the user can't edit

parent 5c7b91e2
...@@ -9,6 +9,10 @@ module NotesHelper ...@@ -9,6 +9,10 @@ module NotesHelper
hidden_field_tag(:target_id, note.noteable.id) hidden_field_tag(:target_id, note.noteable.id)
end end
def note_editable?(note)
note.editable? && can?(current_user, :admin_note, note)
end
def link_to_commit_diff_line_note(note) def link_to_commit_diff_line_note(note)
if note.for_commit_diff_line? if note.for_commit_diff_line?
link_to( link_to(
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
= gfm escape_once(@issue.title) = gfm escape_once(@issue.title)
%div %div
- if @issue.description.present? - if @issue.description.present?
.description.js-task-list-container .description{class: can?(current_user, :modify_issue, @issue) ? 'js-task-list-container' : ''}
.wiki .wiki
= preserve do = preserve do
= markdown(@issue.description) = markdown(@issue.description)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
%div %div
- if @merge_request.description.present? - if @merge_request.description.present?
.description.js-task-list-container .description{class: can?(current_user, :modify_merge_request, @merge_request) ? 'js-task-list-container' : ''}
.wiki .wiki
= preserve do = preserve do
= markdown(@merge_request.description) = markdown(@merge_request.description)
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
= icon('link') = icon('link')
Link here Link here
   
- if can?(current_user, :admin_note, note) && note.editable? - if note_editable?(note)
= link_to '#', title: 'Edit comment', class: 'js-note-edit' do = link_to '#', title: 'Edit comment', class: 'js-note-edit' do
= icon('pencil-square-o') = icon('pencil-square-o')
Edit Edit
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
\-1 \-1
.note-body.js-task-list-container .note-body{class: note_editable?(note) ? 'js-task-list-container' : ''}
.note-text .note-text
= preserve do = preserve do
= markdown(note.note, {no_header_anchors: true}) = markdown(note.note, {no_header_anchors: true})
......
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