diff options
author | Douwe Maan <douwe@selenight.nl> | 2016-07-25 22:48:15 -0600 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2016-07-25 22:48:15 -0600 |
commit | 3b06987c34e73ea044c09b7800170ac1dad93b3b (patch) | |
tree | c7b15c0adef153fbe397e72bbfd7015ecf4765a9 /app | |
parent | d76d051b226893a20060c51128e1eb5bfd86fd3f (diff) | |
download | gitlab-ce-3b06987c34e73ea044c09b7800170ac1dad93b3b.tar.gz |
Hide resolve button when not allowed
Diffstat (limited to 'app')
-rw-r--r-- | app/views/discussions/_resolve_all.html.haml | 12 | ||||
-rw-r--r-- | app/views/projects/notes/_note.html.haml | 59 |
2 files changed, 48 insertions, 23 deletions
diff --git a/app/views/discussions/_resolve_all.html.haml b/app/views/discussions/_resolve_all.html.haml index ddda0b55c14..8b5655af2a1 100644 --- a/app/views/discussions/_resolve_all.html.haml +++ b/app/views/discussions/_resolve_all.html.haml @@ -1,4 +1,8 @@ -%resolve-all{ ":namespace" => "'#{discussion.project.namespace.path}/#{discussion.project.path}'", ":discussion-id" => "'#{discussion.id}'", "inline-template" => true, "v-cloak" => true } - %button.btn.btn-default{ type: "button", "@click" => "resolve", ":disabled" => "loading" } - = icon("spinner spin", "v-show" => "loading") - {{ buttonText }} +- if discussion.can_resolve?(current_user) + %resolve-all{ ":namespace" => "'#{discussion.project.namespace.path}/#{discussion.project.path}'", + ":discussion-id" => "'#{discussion.id}'", + "inline-template" => true, + "v-cloak" => true } + %button.btn.btn-default{ type: "button", "@click" => "resolve", ":disabled" => "loading" } + = icon("spinner spin", "v-show" => "loading") + {{ buttonText }} 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 |