summaryrefslogtreecommitdiff
path: root/app/services/todo_service.rb
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 /app/services/todo_service.rb
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 'app/services/todo_service.rb')
-rw-r--r--app/services/todo_service.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/services/todo_service.rb b/app/services/todo_service.rb
index 6b48d68cccb..eb833dd82ac 100644
--- a/app/services/todo_service.rb
+++ b/app/services/todo_service.rb
@@ -144,8 +144,9 @@ class TodoService
def mark_todos_as_done(todos, current_user)
todos = current_user.todos.where(id: todos.map(&:id)) unless todos.respond_to?(:update_all)
- todos.update_all(state: :done)
+ marked_todos = todos.update_all(state: :done)
current_user.update_todos_count_cache
+ marked_todos
end
# When user marks an issue as todo