diff options
Diffstat (limited to 'app/services/todo_service.rb')
-rw-r--r-- | app/services/todo_service.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/app/services/todo_service.rb b/app/services/todo_service.rb index eb833dd82ac..e0ccb654590 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_ids(todos.select(&:id), current_user) + end + + def mark_todos_as_done_by_ids(ids, current_user) + todos = current_user.todos.where(id: ids) marked_todos = todos.update_all(state: :done) current_user.update_todos_count_cache @@ -155,6 +159,10 @@ class TodoService create_todos(current_user, attributes) end + def todo_exist?(issuable, current_user) + TodosFinder.new(current_user).execute.exists?(target: issuable) + end + private def create_todos(users, attributes) |