Need to save todo after updating state from project. Fixes #834.

This commit is contained in:
Eric Allen 2009-02-01 15:25:09 -05:00
parent 2ee84b8162
commit e40b8ecbcf
2 changed files with 2 additions and 1 deletions

View file

@ -260,6 +260,7 @@ class TodosController < ApplicationController
@project_changed = @original_item_project_id != @todo.project_id @project_changed = @original_item_project_id != @todo.project_id
if (@project_changed && !@original_item_project_id.nil?) then if (@project_changed && !@original_item_project_id.nil?) then
@todo.update_state_from_project @todo.update_state_from_project
@todo.save!
@remaining_undone_in_project = current_user.projects.find(@original_item_project_id).not_done_todo_count @remaining_undone_in_project = current_user.projects.find(@original_item_project_id).not_done_todo_count
end end
determine_down_count determine_down_count

View file

@ -516,7 +516,7 @@ class TodosControllerTest < Test::Rails::TestCase
assert_equal "project_hidden", todo.state assert_equal "project_hidden", todo.state
# clear project from todo: the todo should be unhidden # clear project from todo: the todo should be unhidden
xhr :post, :update, :id => 1, :_source_view => 'todo', "project_name"=>"None", "todo"=>{} xhr :post, :update, :id => 5, :_source_view => 'todo', "project_name"=>"None", "todo"=>{}
todo.reload() todo.reload()
assert_equal "active", todo.state assert_equal "active", todo.state
end end