Don't reload the issue in after_save callback.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11495 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2013-02-28 17:47:58 +00:00
parent 953b3619d4
commit 5bf647f290
3 changed files with 5 additions and 5 deletions

View File

@ -1174,7 +1174,6 @@ class Issue < ActiveRecord::Base
if @parent_issue
move_to_child_of(@parent_issue)
end
reload
elsif parent_issue_id != parent_id
former_parent_id = parent_id
# moving an existing issue
@ -1185,7 +1184,6 @@ class Issue < ActiveRecord::Base
# to another tree
unless root?
move_to_right_of(root)
reload
end
old_root_id = root_id
self.root_id = (@parent_issue.nil? ? id : @parent_issue.root_id )
@ -1199,7 +1197,6 @@ class Issue < ActiveRecord::Base
move_to_child_of(@parent_issue)
end
end
reload
# delete invalid relations of all descendants
self_and_descendants.each do |issue|
issue.relations.each do |relation|

View File

@ -82,8 +82,8 @@ class GanttsControllerTest < ActionController::TestCase
def test_gantt_should_display_relations
IssueRelation.delete_all
issue1 = Issue.generate!(:start_date => 1.day.from_now, :due_date => 3.day.from_now)
issue2 = Issue.generate!(:start_date => 1.day.from_now, :due_date => 3.day.from_now)
issue1 = Issue.generate!(:start_date => 1.day.from_now.to_date, :due_date => 3.day.from_now.to_date)
issue2 = Issue.generate!(:start_date => 1.day.from_now.to_date, :due_date => 3.day.from_now.to_date)
IssueRelation.create!(:issue_from => issue1, :issue_to => issue2, :relation_type => 'precedes')
get :show

View File

@ -1411,6 +1411,7 @@ class IssueTest < ActiveSupport::TestCase
:relation_type => IssueRelation::TYPE_PRECEDES)
assert_equal Date.parse('2012-10-18'), issue2.reload.start_date
issue1.reload
issue1.due_date = '2012-10-23'
issue1.save!
issue2.reload
@ -1425,6 +1426,7 @@ class IssueTest < ActiveSupport::TestCase
:relation_type => IssueRelation::TYPE_PRECEDES)
assert_equal Date.parse('2012-10-18'), issue2.reload.start_date
issue1.reload
issue1.start_date = '2012-09-17'
issue1.due_date = '2012-09-18'
issue1.save!
@ -1443,6 +1445,7 @@ class IssueTest < ActiveSupport::TestCase
:relation_type => IssueRelation::TYPE_PRECEDES)
assert_equal Date.parse('2012-10-18'), issue2.reload.start_date
issue1.reload
issue1.start_date = '2012-09-17'
issue1.due_date = '2012-09-18'
issue1.save!