summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-02-23 17:47:59 +0000
committerRobert Speicher <robert@gitlab.com>2016-02-23 17:47:59 +0000
commit5deb4ac1449d58d61ad891db05174207386929b0 (patch)
tree5400dc7d2099ad53bf7f7a7612bb50311356d62b /app
parent1142b327e8f87c9ecb2ed86f23bf9a1998433956 (diff)
parent28097398c5087c3ffc7dc6cd63cd7f8304d3dae9 (diff)
downloadgitlab-ce-5deb4ac1449d58d61ad891db05174207386929b0.tar.gz
Merge branch 'fix-todos' into 'master'
Does not raise an error when Todo is already marked as done Closes #13681 See merge request !2926
Diffstat (limited to 'app')
-rw-r--r--app/controllers/dashboard/todos_controller.rb2
-rw-r--r--app/models/todo.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/app/controllers/dashboard/todos_controller.rb b/app/controllers/dashboard/todos_controller.rb
index 9ee9039f004..43cf8fa71af 100644
--- a/app/controllers/dashboard/todos_controller.rb
+++ b/app/controllers/dashboard/todos_controller.rb
@@ -15,7 +15,7 @@ class Dashboard::TodosController < Dashboard::ApplicationController
end
def destroy_all
- @todos.each(&:done)
+ @todos.each(&:done!)
respond_to do |format|
format.html { redirect_to dashboard_todos_path, notice: 'All todos were marked as done.' }
diff --git a/app/models/todo.rb b/app/models/todo.rb
index 34d71c1b0d3..5f91991f781 100644
--- a/app/models/todo.rb
+++ b/app/models/todo.rb
@@ -36,7 +36,7 @@ class Todo < ActiveRecord::Base
state_machine :state, initial: :pending do
event :done do
- transition pending: :done
+ transition [:pending, :done] => :done
end
state :pending