summaryrefslogtreecommitdiff
path: root/app/services/todo_service.rb
diff options
context:
space:
mode:
authorJoshua Lambert <joshua@gitlab.com>2017-03-16 18:45:46 +0000
committerJoshua Lambert <joshua@gitlab.com>2017-03-16 18:45:46 +0000
commitd2f209a60b2ea2d889eaf5142c8d09ba0848a4c3 (patch)
tree62810ea2d1f8aa1d131e31ad667c39ea0a6d466a /app/services/todo_service.rb
parent83259875939958c6288066a3a4e59a5062b4c9e6 (diff)
parentce5d1b6fd7ed1aea2d2a675414ba81be624f2bf1 (diff)
downloadgitlab-ce-29142-add-prometheus-integration-documentation.tar.gz
Merge branch 'master' into '29142-add-prometheus-integration-documentation'29142-add-prometheus-integration-documentation
# Conflicts: # doc/install/requirements.md
Diffstat (limited to 'app/services/todo_service.rb')
-rw-r--r--app/services/todo_service.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/services/todo_service.rb b/app/services/todo_service.rb
index 8787a1c93a9..bf7e76ec59e 100644
--- a/app/services/todo_service.rb
+++ b/app/services/todo_service.rb
@@ -201,10 +201,12 @@ class TodoService
def update_todos_state_by_ids(ids, current_user, state)
todos = current_user.todos.where(id: ids)
- # Only return those that are not really on that state
- marked_todos = todos.where.not(state: state).update_all(state: state)
+ # Only update those that are not really on that state
+ todos = todos.where.not(state: state)
+ todos_ids = todos.pluck(:id)
+ todos.update_all(state: state)
current_user.update_todos_count_cache
- marked_todos
+ todos_ids
end
def create_todos(users, attributes)