summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2014-03-26 01:48:20 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2014-03-26 01:48:20 +0000
commit2ec3b3694f6b12e28399d25c8c1b96993cb1aa42 (patch)
tree90cd5751765ccc4da1d1f148b72c9f4870c978af /app/models
parent755108566c0c21760eeae17654ebd37767ed2b9c (diff)
downloadredmine-2ec3b3694f6b12e28399d25c8c1b96993cb1aa42.tar.gz
redmine-2ec3b3694f6b12e28399d25c8c1b96993cb1aa42.zip
fix race condition of highest rgt at Issue#update_nested_set_attributes_on_parent_change (#6579)
git-svn-id: http://svn.redmine.org/redmine/trunk@13011 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r--app/models/issue.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 5a98caa15..8bbb715c4 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -1316,8 +1316,7 @@ class Issue < ActiveRecord::Base
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
+ offset = right_most_bound + 1 - lft
Issue.where(cond).
update_all(["root_id = ?, lft = lft + ?, rgt = rgt + ?", root_id, offset, offset])
self[left_column_name] = lft + offset