From fe617391084e5dc2e2f9d91befbe32b50ecbd41f Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 29 Sep 2012 16:31:13 +0000 Subject: [PATCH] Merged r10494 from trunk. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/2.1-stable@10523 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/issues_controller.rb | 2 +- test/functional/issues_controller_test.rb | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 9f34a0185..24ab2e0a3 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -398,7 +398,7 @@ private end @issue.project = @project - @issue.author = User.current + @issue.author ||= User.current # Tracker must be set before custom field values @issue.tracker ||= @project.trackers.find((params[:issue] && params[:issue][:tracker_id]) || params[:tracker_id] || :first) if @issue.tracker.nil? diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index fdd995c56..7d20c7f53 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -2521,6 +2521,18 @@ class IssuesControllerTest < ActionController::TestCase assert_equal 'This is the test_new issue', issue.subject end + def test_update_edit_form_should_keep_issue_author + @request.session[:user_id] = 3 + xhr :put, :new, :project_id => 1, :id => 1, :issue => {:subject => 'Changed'} + assert_response :success + assert_equal 'text/javascript', response.content_type + + issue = assigns(:issue) + assert_equal User.find(2), issue.author + assert_equal 2, issue.author_id + assert_not_equal User.current, issue.author + end + def test_update_edit_form_should_propose_transitions_based_on_initial_status @request.session[:user_id] = 2 WorkflowTransition.delete_all -- 2.39.5