@@ -261,7 +261,7 class Issue < ActiveRecord::Base | |||
|
261 | 261 | # Copies attributes from another issue, arg can be an id or an Issue |
|
262 | 262 | def copy_from(arg, options={}) |
|
263 | 263 | issue = arg.is_a?(Issue) ? arg : Issue.visible.find(arg) |
|
264 | self.attributes = issue.attributes.dup.except("id", "root_id", "parent_id", "lft", "rgt", "created_on", "updated_on") | |
|
264 | self.attributes = issue.attributes.dup.except("id", "root_id", "parent_id", "lft", "rgt", "created_on", "updated_on", "closed_on") | |
|
265 | 265 | self.custom_field_values = issue.custom_field_values.inject({}) {|h,v| h[v.custom_field_id] = v.value; h} |
|
266 | 266 | self.status = issue.status |
|
267 | 267 | self.author = User.current |
@@ -1394,7 +1394,7 class Issue < ActiveRecord::Base | |||
|
1394 | 1394 | end |
|
1395 | 1395 | Project.where(condition).having_trackers |
|
1396 | 1396 | end |
|
1397 | ||
|
1397 | ||
|
1398 | 1398 | # Returns a scope of trackers that user can assign the issue to |
|
1399 | 1399 | def allowed_target_trackers(user=User.current) |
|
1400 | 1400 | self.class.allowed_target_trackers(project, user, tracker_id_was) |
@@ -760,7 +760,7 class IssueTest < ActiveSupport::TestCase | |||
|
760 | 760 | user = User.find(2) |
|
761 | 761 | group = Group.generate! |
|
762 | 762 | group.users << user |
|
763 | ||
|
763 | ||
|
764 | 764 | issue = Issue.generate!(:author_id => 1, :assigned_to => group) |
|
765 | 765 | assert_include 4, issue.new_statuses_allowed_to(user).map(&:id) |
|
766 | 766 | end |
@@ -1332,6 +1332,16 class IssueTest < ActiveSupport::TestCase | |||
|
1332 | 1332 | end |
|
1333 | 1333 | end |
|
1334 | 1334 | |
|
1335 | def test_copy_should_clear_closed_on | |
|
1336 | copied_open = Issue.find(8).copy(:status_id => 1) | |
|
1337 | assert copied_open.save | |
|
1338 | assert_nil copied_open.closed_on | |
|
1339 | ||
|
1340 | copied_closed = Issue.find(8).copy | |
|
1341 | assert copied_closed.save | |
|
1342 | assert_not_nil copied_closed.closed_on | |
|
1343 | end | |
|
1344 | ||
|
1335 | 1345 | def test_should_not_call_after_project_change_on_creation |
|
1336 | 1346 | issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1, |
|
1337 | 1347 | :subject => 'Test', :author_id => 1) |
General Comments 0
You need to be logged in to leave comments.
Login now