summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAhmad Sherif <me@ahmadsherif.com>2016-08-16 18:55:02 +0200
committerAhmad Sherif <me@ahmadsherif.com>2016-08-18 17:46:24 +0200
commit30654fc9c1afc222ebae5c5367657bd8f6e615b2 (patch)
treebcf07e2723405510a369071b6cf4ac4ee1be4895
parent1f14495124e38a0682476744b95a8299ad06593a (diff)
downloadgitlab-ce-30654fc9c1afc222ebae5c5367657bd8f6e615b2.tar.gz
Simplify SQL queries of marking a todo as done
-rw-r--r--CHANGELOG1
-rw-r--r--app/controllers/dashboard/todos_controller.rb6
2 files changed, 3 insertions, 4 deletions
diff --git a/CHANGELOG b/CHANGELOG
index e6c96b7a6e2..199ea057b09 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -131,6 +131,7 @@ v 8.11.0 (unreleased)
- Ensure file editing in UI does not overwrite commited changes without warning user
- Eliminate unneeded calls to Repository#blob_at when listing commits with no path
- Update gitlab_git gem to 10.4.7
+ - Simplify SQL queries of marking a todo as done
v 8.10.6
- Upgrade Rails to 4.2.7.1 for security fixes. !5781
diff --git a/app/controllers/dashboard/todos_controller.rb b/app/controllers/dashboard/todos_controller.rb
index 1243bb96d4d..1f8cf1d91b0 100644
--- a/app/controllers/dashboard/todos_controller.rb
+++ b/app/controllers/dashboard/todos_controller.rb
@@ -6,6 +6,8 @@ class Dashboard::TodosController < Dashboard::ApplicationController
end
def destroy
+ todo = Todo.new(id: params[:id])
+
TodoService.new.mark_todos_as_done([todo], current_user)
respond_to do |format|
@@ -27,10 +29,6 @@ class Dashboard::TodosController < Dashboard::ApplicationController
private
- def todo
- @todo ||= find_todos.find(params[:id])
- end
-
def find_todos
@todos ||= TodosFinder.new(current_user, params).execute
end