diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-08-03 18:46:49 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-08-03 18:46:49 +0000 |
commit | db271a6b051f9630d5dfb3acbbd78f150cb3f23f (patch) | |
tree | 7339677540a05daf9400452a6f569bbb34ea58bd /lib | |
parent | 00a02d14ac0aa06ab2a9c36ca463381c853a2009 (diff) | |
parent | a488fc0add73963c4839f49a7fe0f7b5b014d15a (diff) | |
download | gitlab-ce-db271a6b051f9630d5dfb3acbbd78f150cb3f23f.tar.gz |
Merge branch 'tc-no-todo-service-select-mysql' into 'master'
Avoid plucking Todo ids in TodoService - take 2
See merge request !11415
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/todos.rb | 6 | ||||
-rw-r--r-- | lib/api/v3/todos.rb | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/api/todos.rb b/lib/api/todos.rb index d1f7e364029..55191169dd4 100644 --- a/lib/api/todos.rb +++ b/lib/api/todos.rb @@ -59,10 +59,10 @@ module API requires :id, type: Integer, desc: 'The ID of the todo being marked as done' end post ':id/mark_as_done' do - todo = current_user.todos.find(params[:id]) - TodoService.new.mark_todos_as_done([todo], current_user) + TodoService.new.mark_todos_as_done_by_ids(params[:id], current_user) + todo = Todo.find(params[:id]) - present todo.reload, with: Entities::Todo, current_user: current_user + present todo, with: Entities::Todo, current_user: current_user end desc 'Mark all todos as done' diff --git a/lib/api/v3/todos.rb b/lib/api/v3/todos.rb index e3b311d61cd..2f2cf259987 100644 --- a/lib/api/v3/todos.rb +++ b/lib/api/v3/todos.rb @@ -11,10 +11,10 @@ module API requires :id, type: Integer, desc: 'The ID of the todo being marked as done' end delete ':id' do - todo = current_user.todos.find(params[:id]) - TodoService.new.mark_todos_as_done([todo], current_user) + TodoService.new.mark_todos_as_done_by_ids(params[:id], current_user) + todo = Todo.find(params[:id]) - present todo.reload, with: ::API::Entities::Todo, current_user: current_user + present todo, with: ::API::Entities::Todo, current_user: current_user end desc 'Mark all todos as done' |