summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorPaco Guzman <pacoguzmanp@gmail.com>2016-08-11 18:39:50 +0200
committerPaco Guzman <pacoguzmanp@gmail.com>2016-08-12 18:21:36 +0200
commitf8b53ba20b74181a46985b0c7dde742239bd54f8 (patch)
treead80cfd4263526d06cc229dfdbeac174c18ffaac /lib/api
parent1f2253545ba7a902212bace29f144a2246eeedab (diff)
downloadgitlab-ce-f8b53ba20b74181a46985b0c7dde742239bd54f8.tar.gz
Recover usage of Todos counter cache20842-todos-queries-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')
-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