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

Resolve all endpoint

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