##// END OF EJS Templates
Merged r15848 (#23764)....
Jean-Philippe Lang -
r15488:3fa2f5253230
parent child
Show More
@@ -261,7 +261,7 class Issue < ActiveRecord::Base
261 # Copies attributes from another issue, arg can be an id or an Issue
261 # Copies attributes from another issue, arg can be an id or an Issue
262 def copy_from(arg, options={})
262 def copy_from(arg, options={})
263 issue = arg.is_a?(Issue) ? arg : Issue.visible.find(arg)
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 self.custom_field_values = issue.custom_field_values.inject({}) {|h,v| h[v.custom_field_id] = v.value; h}
265 self.custom_field_values = issue.custom_field_values.inject({}) {|h,v| h[v.custom_field_id] = v.value; h}
266 self.status = issue.status
266 self.status = issue.status
267 self.author = User.current
267 self.author = User.current
@@ -1394,7 +1394,7 class Issue < ActiveRecord::Base
1394 end
1394 end
1395 Project.where(condition).having_trackers
1395 Project.where(condition).having_trackers
1396 end
1396 end
1397
1397
1398 # Returns a scope of trackers that user can assign the issue to
1398 # Returns a scope of trackers that user can assign the issue to
1399 def allowed_target_trackers(user=User.current)
1399 def allowed_target_trackers(user=User.current)
1400 self.class.allowed_target_trackers(project, user, tracker_id_was)
1400 self.class.allowed_target_trackers(project, user, tracker_id_was)
@@ -760,7 +760,7 class IssueTest < ActiveSupport::TestCase
760 user = User.find(2)
760 user = User.find(2)
761 group = Group.generate!
761 group = Group.generate!
762 group.users << user
762 group.users << user
763
763
764 issue = Issue.generate!(:author_id => 1, :assigned_to => group)
764 issue = Issue.generate!(:author_id => 1, :assigned_to => group)
765 assert_include 4, issue.new_statuses_allowed_to(user).map(&:id)
765 assert_include 4, issue.new_statuses_allowed_to(user).map(&:id)
766 end
766 end
@@ -1332,6 +1332,16 class IssueTest < ActiveSupport::TestCase
1332 end
1332 end
1333 end
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 def test_should_not_call_after_project_change_on_creation
1345 def test_should_not_call_after_project_change_on_creation
1336 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1,
1346 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1,
1337 :subject => 'Test', :author_id => 1)
1347 :subject => 'Test', :author_id => 1)
General Comments 0
You need to be logged in to leave comments. Login now