1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-10-17 17:01:01 +00:00

When create by copying the issue, status can not be changed to default (#19553).

git-svn-id: http://svn.redmine.org/redmine/trunk@14158 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2015-04-11 07:09:11 +00:00
parent b88cac254e
commit 11e8dc263f
2 changed files with 15 additions and 1 deletions

View File

@ -425,7 +425,7 @@ class IssuesController < ApplicationController
@issue.start_date ||= Date.today if Setting.default_issue_start_date_to_creation_date?
if attrs = params[:issue].deep_dup
if params[:was_default_status] == attrs[:status_id]
if action_name == 'new' && params[:was_default_status] == attrs[:status_id]
attrs.delete(:status_id)
end
@issue.safe_attributes = attrs

View File

@ -2605,6 +2605,20 @@ class IssuesControllerTest < ActionController::TestCase
assert_equal 'Copy', issue.subject
end
def test_create_as_copy_should_allow_status_to_be_set_to_default
copied = Issue.generate! :status_id => 2
assert_equal 2, copied.reload.status_id
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
post :create, :project_id => 1, :copy_from => copied.id,
:issue => {:project_id => '1', :tracker_id => '1', :status_id => '1'},
:was_default_status => '1'
end
issue = Issue.order('id DESC').first
assert_equal 1, issue.status_id
end
def test_create_as_copy_should_copy_attachments
@request.session[:user_id] = 2
issue = Issue.find(3)