]> source.dussan.org Git - redmine.git/commitdiff
Merged r10494 from trunk.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 29 Sep 2012 16:31:13 +0000 (16:31 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 29 Sep 2012 16:31:13 +0000 (16:31 +0000)
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
test/functional/issues_controller_test.rb

index 9f34a0185c9d5f448a9b8c9c10a1e51a169305a9..24ab2e0a3603573bd25fd9356602c9bd666e17da 100644 (file)
@@ -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?
index fdd995c5657233b127c7bae971b8eebb2ebe6c89..7d20c7f53ad6023bf4a1c4eb5b7203a183321598 100644 (file)
@@ -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