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:
authorAhmad Sherif <me@ahmadsherif.com>2016-08-16 23:10:37 +0300
committerAhmad Sherif <me@ahmadsherif.com>2016-08-18 18:46:24 +0300
commit548da42be51821951180eacf462d942c11c0c01b (patch)
tree56d3335fe86ae4c4a2dfc26951d241c8d762d34e /app/services
parent30654fc9c1afc222ebae5c5367657bd8f6e615b2 (diff)
Implement TodoService#mark_todos_as_done_by_id
Follow-up on 52b0c26
Diffstat (limited to 'app/services')
-rw-r--r--app/services/todo_service.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/services/todo_service.rb b/app/services/todo_service.rb
index eb833dd82ac..5a2f7946082 100644
--- a/app/services/todo_service.rb
+++ b/app/services/todo_service.rb
@@ -142,7 +142,11 @@ class TodoService
# When user marks some todos as done
def mark_todos_as_done(todos, current_user)
- todos = current_user.todos.where(id: todos.map(&:id)) unless todos.respond_to?(:update_all)
+ mark_todos_as_done_by_id(todos.select(&:id), current_user)
+ end
+
+ def mark_todos_as_done_by_id(ids, current_user)
+ todos = current_user.todos.where(id: ids)
marked_todos = todos.update_all(state: :done)
current_user.update_todos_count_cache