diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-08-15 12:18:27 +0000 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-08-15 12:18:27 +0000 |
commit | 20f9b8be2fa53034aa867882cdcd4ccd2f019d29 (patch) | |
tree | b8ae200d4e0dec6cd17568c96b48d1405baae30b /lib | |
parent | 49139f00540a0c7a5d4173c7a7b31d73d3befdfd (diff) | |
parent | f8b53ba20b74181a46985b0c7dde742239bd54f8 (diff) | |
download | gitlab-ce-20f9b8be2fa53034aa867882cdcd4ccd2f019d29.tar.gz |
Merge branch '20842-todos-queries-cache' into 'master'
Try to get back todo's cache or at least avoid hitting the database
See merge request !5789
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/todos.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/api/todos.rb b/lib/api/todos.rb index 26c24c3baff..19df13d8aac 100644 --- a/lib/api/todos.rb +++ b/lib/api/todos.rb @@ -61,9 +61,9 @@ module API # delete ':id' do todo = current_user.todos.find(params[:id]) - todo.done + TodoService.new.mark_todos_as_done([todo], current_user) - present todo, with: Entities::Todo, current_user: current_user + present todo.reload, with: Entities::Todo, current_user: current_user end # Mark all todos as done @@ -73,9 +73,7 @@ module API # delete do todos = find_todos - todos.each(&:done) - - todos.length + TodoService.new.mark_todos_as_done(todos, current_user) end end end |