Feature #4403 » copy_to_another_project_and_relate.patch
| test/functional/issues_controller_test.rb (working copy) | ||
|---|---|---|
|
issue = Issue.first(:order => 'id DESC')
|
||
|
assert_redirected_to :controller => 'issues', :action => 'show', :id => issue
|
||
|
end
|
||
|
def test_copy_to_another_project_and_relate
|
||
|
@request.session[:user_id] = 2
|
||
|
Setting.cross_project_issue_relations = 1
|
||
|
post :move, :ids => [1], :new_project_id => 2, :copy_options => {:copy => '1'}, :follow => '1'
|
||
|
issue = Issue.first(:order => 'id DESC')
|
||
|
orig = Issue.last(:order => 'id DESC')
|
||
|
assert_equal issue.subject, orig.subject
|
||
|
assert_not_equal 0, issue.relations_from.size
|
||
|
end
|
||
|
|
||
|
def test_context_menu_one_issue
|
||
|
@request.session[:user_id] = 2
|
||
| app/controllers/issues_controller.rb (working copy) | ||
|---|---|---|
|
call_hook(:controller_issues_move_before_save, { :params => params, :issue => issue, :target_project => @target_project, :copy => !!@copy })
|
||
|
if r = issue.move_to_project(@target_project, new_tracker, {:copy => @copy, :attributes => changed_attributes})
|
||
|
moved_issues << r
|
||
|
if @copy && Setting.cross_project_issue_relations?
|
||
|
relation = IssueRelation.new
|
||
|
relation.issue_to = issue
|
||
|
relation.issue_from = r
|
||
|
relation.relation_type = "duplicates"
|
||
|
relation.save
|
||
|
end
|
||
|
else
|
||
|
unsaved_issue_ids << issue.id
|
||
|
end
|
||