Adds subtasking (#443) including:

* priority, start/due dates, progress, estimate, spent time roll-up to parent issues
* descendant issues tree displayed on the issue view with context menu support
* issue tree display on the gantt chart
* issue tree copy on project copy
* unlimited nesting

Defining subtasks requires the new permission 'Manage subtasks'.
Subtasks can not belong to a different project than the parent task.

Implementation is based on scoped nested sets for fast reads and updates.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3573 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2010-03-13 14:56:49 +00:00
parent e109c9b6b6
commit 8e3d1b694a
28 changed files with 855 additions and 93 deletions

View File

@@ -329,7 +329,7 @@ class IssueTest < ActiveSupport::TestCase
def test_move_to_another_project_with_same_category
issue = Issue.find(1)
assert issue.move_to(Project.find(2))
assert issue.move_to_project(Project.find(2))
issue.reload
assert_equal 2, issue.project_id
# Category changes
@@ -340,7 +340,7 @@ class IssueTest < ActiveSupport::TestCase
def test_move_to_another_project_without_same_category
issue = Issue.find(2)
assert issue.move_to(Project.find(2))
assert issue.move_to_project(Project.find(2))
issue.reload
assert_equal 2, issue.project_id
# Category cleared
@@ -350,7 +350,7 @@ class IssueTest < ActiveSupport::TestCase
def test_move_to_another_project_should_clear_fixed_version_when_not_shared
issue = Issue.find(1)
issue.update_attribute(:fixed_version_id, 1)
assert issue.move_to(Project.find(2))
assert issue.move_to_project(Project.find(2))
issue.reload
assert_equal 2, issue.project_id
# Cleared fixed_version
@@ -360,7 +360,7 @@ class IssueTest < ActiveSupport::TestCase
def test_move_to_another_project_should_keep_fixed_version_when_shared_with_the_target_project
issue = Issue.find(1)
issue.update_attribute(:fixed_version_id, 4)
assert issue.move_to(Project.find(5))
assert issue.move_to_project(Project.find(5))
issue.reload
assert_equal 5, issue.project_id
# Keep fixed_version
@@ -370,7 +370,7 @@ class IssueTest < ActiveSupport::TestCase
def test_move_to_another_project_should_clear_fixed_version_when_not_shared_with_the_target_project
issue = Issue.find(1)
issue.update_attribute(:fixed_version_id, 1)
assert issue.move_to(Project.find(5))
assert issue.move_to_project(Project.find(5))
issue.reload
assert_equal 5, issue.project_id
# Cleared fixed_version
@@ -380,7 +380,7 @@ class IssueTest < ActiveSupport::TestCase
def test_move_to_another_project_should_keep_fixed_version_when_shared_systemwide
issue = Issue.find(1)
issue.update_attribute(:fixed_version_id, 7)
assert issue.move_to(Project.find(2))
assert issue.move_to_project(Project.find(2))
issue.reload
assert_equal 2, issue.project_id
# Keep fixed_version
@@ -392,7 +392,7 @@ class IssueTest < ActiveSupport::TestCase
target = Project.find(2)
target.tracker_ids = [3]
target.save
assert_equal false, issue.move_to(target)
assert_equal false, issue.move_to_project(target)
issue.reload
assert_equal 1, issue.project_id
end
@@ -401,7 +401,7 @@ class IssueTest < ActiveSupport::TestCase
issue = Issue.find(1)
copy = nil
assert_difference 'Issue.count' do
copy = issue.move_to(issue.project, nil, :copy => true)
copy = issue.move_to_project(issue.project, nil, :copy => true)
end
assert_kind_of Issue, copy
assert_equal issue.project, copy.project
@@ -412,8 +412,9 @@ class IssueTest < ActiveSupport::TestCase
issue = Issue.find(1)
copy = nil
assert_difference 'Issue.count' do
copy = issue.move_to(Project.find(3), Tracker.find(2), :copy => true)
copy = issue.move_to_project(Project.find(3), Tracker.find(2), :copy => true)
end
copy.reload
assert_kind_of Issue, copy
assert_equal Project.find(3), copy.project
assert_equal Tracker.find(2), copy.tracker
@@ -421,7 +422,7 @@ class IssueTest < ActiveSupport::TestCase
assert_nil copy.custom_value_for(2)
end
context "#move_to" do
context "#move_to_project" do
context "as a copy" do
setup do
@issue = Issue.find(1)
@@ -429,24 +430,24 @@ class IssueTest < ActiveSupport::TestCase
end
should "allow assigned_to changes" do
@copy = @issue.move_to(Project.find(3), Tracker.find(2), {:copy => true, :attributes => {:assigned_to_id => 3}})
@copy = @issue.move_to_project(Project.find(3), Tracker.find(2), {:copy => true, :attributes => {:assigned_to_id => 3}})
assert_equal 3, @copy.assigned_to_id
end
should "allow status changes" do
@copy = @issue.move_to(Project.find(3), Tracker.find(2), {:copy => true, :attributes => {:status_id => 2}})
@copy = @issue.move_to_project(Project.find(3), Tracker.find(2), {:copy => true, :attributes => {:status_id => 2}})
assert_equal 2, @copy.status_id
end
should "allow start date changes" do
date = Date.today
@copy = @issue.move_to(Project.find(3), Tracker.find(2), {:copy => true, :attributes => {:start_date => date}})
@copy = @issue.move_to_project(Project.find(3), Tracker.find(2), {:copy => true, :attributes => {:start_date => date}})
assert_equal date, @copy.start_date
end
should "allow due date changes" do
date = Date.today
@copy = @issue.move_to(Project.find(3), Tracker.find(2), {:copy => true, :attributes => {:due_date => date}})
@copy = @issue.move_to_project(Project.find(3), Tracker.find(2), {:copy => true, :attributes => {:due_date => date}})
assert_equal date, @copy.due_date
end
@@ -457,7 +458,7 @@ class IssueTest < ActiveSupport::TestCase
issue = Issue.find(12)
assert issue.recipients.include?(issue.author.mail)
# move the issue to a private project
copy = issue.move_to(Project.find(5), Tracker.find(2), :copy => true)
copy = issue.move_to_project(Project.find(5), Tracker.find(2), :copy => true)
# author is not a member of project anymore
assert !copy.recipients.include?(copy.author.mail)
end