diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-04-29 20:34:43 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-05-06 13:00:13 -0400 |
commit | 725ff58bc891bfdad60f55db6b0dacdba11b1b20 (patch) | |
tree | 112bd608c25ffa5b568cf1bedccfaa6a90917144 /app | |
parent | 5c7b91e29b500c2e9c991c798552343626c0f7c1 (diff) | |
download | gitlab-ce-725ff58bc891bfdad60f55db6b0dacdba11b1b20.tar.gz |
Don't add js-task-list-container to things the user can't edit
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/notes_helper.rb | 4 | ||||
-rw-r--r-- | app/views/projects/issues/show.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/merge_requests/show/_mr_box.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/notes/_note.html.haml | 4 |
4 files changed, 8 insertions, 4 deletions
diff --git a/app/helpers/notes_helper.rb b/app/helpers/notes_helper.rb index ab44fa6ee43..271b53aa2b6 100644 --- a/app/helpers/notes_helper.rb +++ b/app/helpers/notes_helper.rb @@ -9,6 +9,10 @@ module NotesHelper hidden_field_tag(:target_id, note.noteable.id) end + def note_editable?(note) + note.editable? && can?(current_user, :admin_note, note) + end + def link_to_commit_diff_line_note(note) if note.for_commit_diff_line? link_to( diff --git a/app/views/projects/issues/show.html.haml b/app/views/projects/issues/show.html.haml index 4c92823503d..ee1b2a08bc4 100644 --- a/app/views/projects/issues/show.html.haml +++ b/app/views/projects/issues/show.html.haml @@ -31,7 +31,7 @@ = gfm escape_once(@issue.title) %div - if @issue.description.present? - .description.js-task-list-container + .description{class: can?(current_user, :modify_issue, @issue) ? 'js-task-list-container' : ''} .wiki = preserve do = markdown(@issue.description) diff --git a/app/views/projects/merge_requests/show/_mr_box.html.haml b/app/views/projects/merge_requests/show/_mr_box.html.haml index d5aab122b75..b3470ba37d6 100644 --- a/app/views/projects/merge_requests/show/_mr_box.html.haml +++ b/app/views/projects/merge_requests/show/_mr_box.html.haml @@ -3,7 +3,7 @@ %div - 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 = preserve do = markdown(@merge_request.description) diff --git a/app/views/projects/notes/_note.html.haml b/app/views/projects/notes/_note.html.haml index d582b247a44..4d26b52df01 100644 --- a/app/views/projects/notes/_note.html.haml +++ b/app/views/projects/notes/_note.html.haml @@ -13,7 +13,7 @@ = icon('link') 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 = icon('pencil-square-o') Edit @@ -50,7 +50,7 @@ \-1 - .note-body.js-task-list-container + .note-body{class: note_editable?(note) ? 'js-task-list-container' : ''} .note-text = preserve do = markdown(note.note, {no_header_anchors: true}) |