]> source.dussan.org Git - redmine.git/commitdiff
Fixed that issue author is assigned with current user when the edit form is updated...
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 27 Sep 2012 22:12:11 +0000 (22:12 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 27 Sep 2012 22:12:11 +0000 (22:12 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10494 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 b6e583fdad5dc1c07648a7e589b7dd885a0ad4a7..8f8f1e27b2b73c03450d58f410d59e2b123fc2b5 100644 (file)
@@ -2534,6 +2534,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