From 95810125bf1d3afe7803df2d812de6af1837ef62 2014-12-08 17:30:47 From: Jean-Philippe Lang Date: 2014-12-08 17:30:47 Subject: [PATCH] Don't create a journal when creating an issue with attachments. git-svn-id: http://svn.redmine.org/redmine/trunk@13733 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index ff04d05..11b2543 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -407,9 +407,9 @@ class IssuesController < ApplicationController def build_new_issue_from_params if params[:id].blank? @issue = Issue.new - @issue.init_journal(User.current) if params[:copy_from] begin + @issue.init_journal(User.current) @copy_from = Issue.visible.find(params[:copy_from]) @link_copy = link_copy?(params[:link_copy]) || request.get? @copy_attachments = params[:copy_attachments].present? || request.get? diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 91a9bc6..75368d9 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -2225,9 +2225,11 @@ class IssuesControllerTest < ActionController::TestCase assert_difference 'Issue.count' do assert_difference 'Attachment.count' do - post :create, :project_id => 1, - :issue => { :tracker_id => '1', :subject => 'With attachment' }, - :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}} + assert_no_difference 'Journal.count' do + post :create, :project_id => 1, + :issue => { :tracker_id => '1', :subject => 'With attachment' }, + :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}} + end end end