@@ -1312,19 +1312,13 class Issue < ActiveRecord::Base | |||||
1312 | move_to_right_of(root) |
|
1312 | move_to_right_of(root) | |
1313 | end |
|
1313 | end | |
1314 | old_root_id = root_id |
|
1314 | old_root_id = root_id | |
1315 | in_tenacious_transaction do |
|
|||
1316 | @parent_issue.reload_nested_set if @parent_issue |
|
|||
1317 | self.reload_nested_set |
|
|||
1318 |
|
|
1315 | self.root_id = (@parent_issue.nil? ? id : @parent_issue.root_id ) | |
1319 | cond = ["root_id = ? AND lft >= ? AND rgt <= ? ", old_root_id, lft, rgt] |
|
|||
1320 | self.class.base_class.select('id').lock(true).where(cond) |
|
|||
1321 |
|
|
1316 | target_maxright = nested_set_scope.maximum(right_column_name) || 0 | |
1322 |
|
|
1317 | offset = target_maxright + 1 - lft | |
1323 | Issue.where(cond). |
|
1318 | Issue.where(["root_id = ? AND lft >= ? AND rgt <= ? ", old_root_id, lft, rgt]). | |
1324 |
|
|
1319 | update_all(["root_id = ?, lft = lft + ?, rgt = rgt + ?", root_id, offset, offset]) | |
1325 |
|
|
1320 | self[left_column_name] = lft + offset | |
1326 |
|
|
1321 | self[right_column_name] = rgt + offset | |
1327 | end |
|
|||
1328 | if @parent_issue |
|
1322 | if @parent_issue | |
1329 | move_to_child_of(@parent_issue) |
|
1323 | move_to_child_of(@parent_issue) | |
1330 | end |
|
1324 | end |
General Comments 0
You need to be logged in to leave comments.
Login now