From: Toshi MARUYAMA Date: Tue, 25 Feb 2014 06:53:35 +0000 (+0000) Subject: revert r12925 of 2.5-stable X-Git-Tag: 2.5.0~10 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=51175ede2cd6e50878f32852693f0d2df70d6cf5;p=redmine.git revert r12925 of 2.5-stable I mistook to commit in stable branch. git-svn-id: http://svn.redmine.org/redmine/branches/2.5-stable@12926 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/models/issue.rb b/app/models/issue.rb index c8d45d7d7..2c2e9f087 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -1312,19 +1312,13 @@ class Issue < ActiveRecord::Base move_to_right_of(root) end old_root_id = root_id - in_tenacious_transaction do - @parent_issue.reload_nested_set if @parent_issue - self.reload_nested_set - self.root_id = (@parent_issue.nil? ? id : @parent_issue.root_id) - cond = ["root_id = ? AND lft >= ? AND rgt <= ? ", old_root_id, lft, rgt] - self.class.base_class.select('id').lock(true).where(cond) - target_maxright = nested_set_scope.maximum(right_column_name) || 0 - offset = target_maxright + 1 - lft - Issue.where(cond). - update_all(["root_id = ?, lft = lft + ?, rgt = rgt + ?", root_id, offset, offset]) - self[left_column_name] = lft + offset - self[right_column_name] = rgt + offset - end + self.root_id = (@parent_issue.nil? ? id : @parent_issue.root_id ) + target_maxright = nested_set_scope.maximum(right_column_name) || 0 + offset = target_maxright + 1 - lft + Issue.where(["root_id = ? AND lft >= ? AND rgt <= ? ", old_root_id, lft, rgt]). + update_all(["root_id = ?, lft = lft + ?, rgt = rgt + ?", root_id, offset, offset]) + self[left_column_name] = lft + offset + self[right_column_name] = rgt + offset if @parent_issue move_to_child_of(@parent_issue) end