Commit 3b06987c authored by Douwe Maan's avatar Douwe Maan

Hide resolve button when not allowed

parent d76d051b
%resolve-all{ ":namespace" => "'#{discussion.project.namespace.path}/#{discussion.project.path}'", ":discussion-id" => "'#{discussion.id}'", "inline-template" => true, "v-cloak" => true } - if discussion.can_resolve?(current_user)
%button.btn.btn-default{ type: "button", "@click" => "resolve", ":disabled" => "loading" } %resolve-all{ ":namespace" => "'#{discussion.project.namespace.path}/#{discussion.project.path}'",
= icon("spinner spin", "v-show" => "loading") ":discussion-id" => "'#{discussion.id}'",
{{ buttonText }} "inline-template" => true,
"v-cloak" => true }
%button.btn.btn-default{ type: "button", "@click" => "resolve", ":disabled" => "loading" }
= icon("spinner spin", "v-show" => "loading")
{{ buttonText }}
...@@ -16,25 +16,46 @@ ...@@ -16,25 +16,46 @@
commented commented
%a{ href: "##{dom_id(note)}" } %a{ href: "##{dom_id(note)}" }
= time_ago_with_tooltip(note.created_at, placement: 'bottom', html_class: 'note-created-ago') = time_ago_with_tooltip(note.created_at, placement: 'bottom', html_class: 'note-created-ago')
.note-actions - unless note.system?
- access = note_max_access_for_user(note) .note-actions
- if access and not note.system - access = note_max_access_for_user(note)
%span.note-role.hidden-xs= access - if access
- if !note.system && note.new_diff_note? && current_user %span.note-role.hidden-xs= access
%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 - if note.resolvable?
= icon("spin spinner", "v-show" => "loading") - if can?(current_user, :resolve_note, note)
%button.line-resolve-btn{ type: "button", ":class" => "{ 'is-active': isResolved }", ":aria-label" => "buttonText", "@click" => "resolve", ":title" => "buttonText", "v-show" => "!loading", "v-el:button" => true } %resolve-btn{ ":namespace" => "'#{note.project.namespace.path}/#{note.project.path}'",
= icon("check") ":discussion-id" => "'#{note.discussion_id}'",
- if current_user and not note.system ":note-id" => note.id,
= link_to '#', title: 'Award Emoji', class: 'note-action-button note-emoji-button js-add-award js-note-emoji', data: { position: 'right' } do ":resolved" => note.resolved?,
= icon('spinner spin') "inline-template" => true,
= icon('smile-o') "v-ref:note_#{note.id}" => true }
- if note_editable
= link_to '#', title: 'Edit comment', class: 'note-action-button js-note-edit' do .note-action-button
= icon('pencil') = icon("spin spinner", "v-show" => "loading")
= 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 %button.line-resolve-btn{ type: "button",
= icon('trash-o') ":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-body{class: note_editable ? 'js-task-list-container' : ''}
.note-text.md .note-text.md
= preserve do = preserve do
......
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