Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaco Guzman <pacoguzmanp@gmail.com>2016-08-11 19:39:50 +0300
committerPaco Guzman <pacoguzmanp@gmail.com>2016-08-12 19:21:36 +0300
commitf8b53ba20b74181a46985b0c7dde742239bd54f8 (patch)
treead80cfd4263526d06cc229dfdbeac174c18ffaac /lib/api/todos.rb
parent1f2253545ba7a902212bace29f144a2246eeedab (diff)
Recover usage of Todos counter cache
We’re being kept up to date the counter data but we’re not using it. The only thing which is not real if is the number of projects that the user read changes the number of todos can be stale for some time. The counters will be sync just after the user receives a new todo or mark any as done
Diffstat (limited to 'lib/api/todos.rb')
-rw-r--r--lib/api/todos.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/api/todos.rb b/lib/api/todos.rb
index a90a667fafe..19df13d8aac 100644
--- a/lib/api/todos.rb
+++ b/lib/api/todos.rb
@@ -61,9 +61,9 @@ module API
#
delete ':id' do
todo = current_user.todos.find(params[:id])
- todo.done
+ TodoService.new.mark_todos_as_done([todo], current_user)
- present todo, with: Entities::Todo, current_user: current_user
+ present todo.reload, with: Entities::Todo, current_user: current_user
end
# Mark all todos as done
@@ -74,8 +74,6 @@ module API
delete do
todos = find_todos
TodoService.new.mark_todos_as_done(todos, current_user)
-
- todos.length
end
end
end