summaryrefslogtreecommitdiff
path: root/app/views/projects/notes
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2016-07-25 22:48:15 -0600
committerDouwe Maan <douwe@selenight.nl>2016-07-25 22:48:15 -0600
commit3b06987c34e73ea044c09b7800170ac1dad93b3b (patch)
treec7b15c0adef153fbe397e72bbfd7015ecf4765a9 /app/views/projects/notes
parentd76d051b226893a20060c51128e1eb5bfd86fd3f (diff)
downloadgitlab-ce-3b06987c34e73ea044c09b7800170ac1dad93b3b.tar.gz
Hide resolve button when not allowed
Diffstat (limited to 'app/views/projects/notes')
-rw-r--r--app/views/projects/notes/_note.html.haml59
1 files changed, 40 insertions, 19 deletions
diff --git a/app/views/projects/notes/_note.html.haml b/app/views/projects/notes/_note.html.haml
index 8ae252a9f29..0fce8d06b5f 100644
--- a/app/views/projects/notes/_note.html.haml
+++ b/app/views/projects/notes/_note.html.haml
@@ -16,25 +16,46 @@
commented
%a{ href: "##{dom_id(note)}" }
= time_ago_with_tooltip(note.created_at, placement: 'bottom', html_class: 'note-created-ago')
- .note-actions
- - access = note_max_access_for_user(note)
- - if access and not note.system
- %span.note-role.hidden-xs= access
- - if !note.system && note.new_diff_note? && current_user
- %resolve-btn{ ":namespace" => "'#{note.project.namespace.path}/#{note.project.path}'", ":discussion-id" => "'#{note.discussion_id}'", ":note-id" => note.id, ":resolved" => "false", "inline-template" => true, "v-ref:note_#{note.id}" => true }
- .note-action-button
- = icon("spin spinner", "v-show" => "loading")
- %button.line-resolve-btn{ type: "button", ":class" => "{ 'is-active': isResolved }", ":aria-label" => "buttonText", "@click" => "resolve", ":title" => "buttonText", "v-show" => "!loading", "v-el:button" => true }
- = icon("check")
- - if current_user and not note.system
- = link_to '#', title: 'Award Emoji', class: 'note-action-button note-emoji-button js-add-award js-note-emoji', data: { position: 'right' } do
- = icon('spinner spin')
- = icon('smile-o')
- - if note_editable
- = link_to '#', title: 'Edit comment', class: 'note-action-button js-note-edit' do
- = icon('pencil')
- = link_to namespace_project_note_path(note.project.namespace, note.project, note), title: 'Remove comment', method: :delete, data: { confirm: 'Are you sure you want to remove this comment?' }, remote: true, class: 'note-action-button hidden-xs js-note-delete danger' do
- = icon('trash-o')
+ - unless note.system?
+ .note-actions
+ - access = note_max_access_for_user(note)
+ - if access
+ %span.note-role.hidden-xs= access
+
+ - if note.resolvable?
+ - if can?(current_user, :resolve_note, note)
+ %resolve-btn{ ":namespace" => "'#{note.project.namespace.path}/#{note.project.path}'",
+ ":discussion-id" => "'#{note.discussion_id}'",
+ ":note-id" => note.id,
+ ":resolved" => note.resolved?,
+ "inline-template" => true,
+ "v-ref:note_#{note.id}" => true }
+
+ .note-action-button
+ = icon("spin spinner", "v-show" => "loading")
+ %button.line-resolve-btn{ type: "button",
+ ":class" => "{ 'is-active': isResolved }",
+ ":aria-label" => "buttonText",
+ "@click" => "resolve",
+ ":title" => "buttonText",
+ "v-show" => "!loading",
+ "v-el:button" => true }
+
+ = icon("check")
+ - else
+ -# TODO: Just render status
+
+ - if current_user
+ - if note.emoji_awardable?
+ = link_to '#', title: 'Award Emoji', class: 'note-action-button note-emoji-button js-add-award js-note-emoji', data: { position: 'right' } do
+ = icon('spinner spin')
+ = icon('smile-o')
+
+ - if note_editable
+ = link_to '#', title: 'Edit comment', class: 'note-action-button js-note-edit' do
+ = icon('pencil')
+ = link_to namespace_project_note_path(note.project.namespace, note.project, note), title: 'Remove comment', method: :delete, data: { confirm: 'Are you sure you want to remove this comment?' }, remote: true, class: 'note-action-button hidden-xs js-note-delete danger' do
+ = icon('trash-o')
.note-body{class: note_editable ? 'js-task-list-container' : ''}
.note-text.md
= preserve do