Fixed: the default status is lost when reordering issue statuses (#1955).

git-svn-id: http://redmine.rubyforge.org/svn/trunk@1911 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2008-09-28 08:05:55 +00:00
parent ad06bec6b6
commit 925ef8f4f0
2 changed files with 9 additions and 2 deletions

View File

@ -25,8 +25,8 @@ class IssueStatus < ActiveRecord::Base
validates_length_of :name, :maximum => 30 validates_length_of :name, :maximum => 30
validates_format_of :name, :with => /^[\w\s\'\-]*$/i validates_format_of :name, :with => /^[\w\s\'\-]*$/i
def before_save def after_save
IssueStatus.update_all "is_default=#{connection.quoted_false}" if self.is_default? IssueStatus.update_all("is_default=#{connection.quoted_false}", ['id <> ?', id]) if self.is_default?
end end
# Returns the default status for new issues # Returns the default status for new issues

View File

@ -46,4 +46,11 @@ class IssueStatusTest < Test::Unit::TestCase
assert_equal status, IssueStatus.default assert_equal status, IssueStatus.default
assert !IssueStatus.find(1).is_default assert !IssueStatus.find(1).is_default
end end
def test_reorder_should_not_clear_default_status
status = IssueStatus.default
status.move_to_bottom
status.reload
assert status.is_default?
end
end end