Commit a55c1232 authored by Phil Hughes's avatar Phil Hughes Committed by Douwe Maan

Resolve all endpoint

parent 50e0728c
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
data: -> data: ->
comments: CommentsStore.state comments: CommentsStore.state
loading: false loading: false
props:
endpoint: String
computed: computed:
resolved: -> resolved: ->
resolvedCount = 0 resolvedCount = 0
...@@ -19,9 +21,8 @@ ...@@ -19,9 +21,8 @@
ids = CommentsStore.getAllForState(this.allResolved) ids = CommentsStore.getAllForState(this.allResolved)
this.$set('loading', true) this.$set('loading', true)
promise = if this.allResolved then ResolveService.resolveAll(ids) else ResolveService.resolveAll(ids) ResolveService
.resolveAll(this.endpoint, ids, !this.allResolved)
promise
.done => .done =>
CommentsStore.updateAll(!this.allResolved) CommentsStore.updateAll(!this.allResolved)
.always => .always =>
......
...@@ -5,15 +5,10 @@ ...@@ -5,15 +5,10 @@
resolved: resolve resolved: resolve
type: 'post' type: 'post'
url: endpoint url: endpoint
resolveAll: (ids) -> resolveAll: (endpoint, ids, resolve) ->
$.ajax $.ajax
data: data:
id: ids id: ids
type: 'get' resolve: resolve
url: '/' type: 'post'
unResolveAll: (ids) -> url: endpoint
$.ajax
data:
id: ids
type: 'get'
url: '/'
...@@ -71,6 +71,11 @@ class Projects::NotesController < Projects::ApplicationController ...@@ -71,6 +71,11 @@ class Projects::NotesController < Projects::ApplicationController
render nothing: true, status: 200 render nothing: true, status: 200
end end
def resolve_all
sleep 2
render nothing: true, status: 200
end
private private
def note def note
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
- if current_user - if current_user
#resolve-all-app{ "v-cloak" => true } #resolve-all-app{ "v-cloak" => true }
%resolve-all{ "inline-template" => true } %resolve-all{ ":endpoint" => "'#{resolve_all_namespace_project_notes_path(@project.namespace, @project)}'", "inline-template" => true }
.line-resolve-all{ "v-show" => "commentsCount > 0" } .line-resolve-all{ "v-show" => "commentsCount > 0" }
%button.btn.btn-gray{ type: "button", "aria-label" => "Resolve all", "@click" => "updateAll", ":disabled" => "loading" } %button.btn.btn-gray{ type: "button", "aria-label" => "Resolve all", "@click" => "updateAll", ":disabled" => "loading" }
= icon("spinner spin", "v-show" => "loading") = icon("spinner spin", "v-show" => "loading")
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
%span.line-resolve-text %span.line-resolve-text
{{ resolved }}/{{ commentsCount }} comments resolved {{ resolved }}/{{ commentsCount }} comments resolved
- if @commits.nonzero? - if @commits_count.nonzero?
%ul.merge-request-tabs.nav-links.no-top.no-bottom %ul.merge-request-tabs.nav-links.no-top.no-bottom
%li.notes-tab %li.notes-tab
= link_to namespace_project_merge_request_path(@project.namespace, @project, @merge_request), data: {target: 'div#notes', action: 'notes', toggle: 'tab'} do = link_to namespace_project_merge_request_path(@project.namespace, @project, @merge_request), data: {target: 'div#notes', action: 'notes', toggle: 'tab'} do
......
...@@ -825,6 +825,10 @@ Rails.application.routes.draw do ...@@ -825,6 +825,10 @@ Rails.application.routes.draw do
resources :group_links, only: [:index, :create, :destroy], constraints: { id: /\d+/ } resources :group_links, only: [:index, :create, :destroy], constraints: { id: /\d+/ }
resources :notes, only: [:index, :create, :destroy, :update], constraints: { id: /\d+/ } do resources :notes, only: [:index, :create, :destroy, :update], constraints: { id: /\d+/ } do
collection do
post :resolve_all
end
member do member do
post :toggle_award_emoji post :toggle_award_emoji
delete :delete_attachment delete :delete_attachment
......
This diff is collapsed.
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