From: Eric Davis Date: Mon, 25 Oct 2010 18:44:46 +0000 (+0000) Subject: Allow adding notes when moving issues X-Git-Tag: 1.1.0~243 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=397222f1984b7d00a88b718d4a97ce40ccabbedd;p=redmine.git Allow adding notes when moving issues git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4292 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/controllers/issue_moves_controller.rb b/app/controllers/issue_moves_controller.rb index 028d4d6d7..341230897 100644 --- a/app/controllers/issue_moves_controller.rb +++ b/app/controllers/issue_moves_controller.rb @@ -18,6 +18,7 @@ class IssueMovesController < ApplicationController @issues.each do |issue| issue.reload issue.init_journal(User.current) + issue.current_journal.notes = @notes if @notes.present? call_hook(:controller_issues_move_before_save, { :params => params, :issue => issue, :target_project => @target_project, :copy => !!@copy }) if r = issue.move_to_project(@target_project, new_tracker, {:copy => @copy, :attributes => extract_changed_attributes_for_move(params)}) moved_issues << r @@ -50,6 +51,8 @@ class IssueMovesController < ApplicationController @target_project ||= @project @trackers = @target_project.trackers @available_statuses = Workflow.available_statuses(@project) + @notes = params[:notes] + @notes ||= '' end def extract_changed_attributes_for_move(params) diff --git a/app/views/issue_moves/new.rhtml b/app/views/issue_moves/new.rhtml index 946ddab95..c51399eb6 100644 --- a/app/views/issue_moves/new.rhtml +++ b/app/views/issue_moves/new.rhtml @@ -48,6 +48,11 @@ <%= text_field_tag 'due_date', '', :size => 10 %><%= calendar_for('due_date') %>

+
<%= l(:field_notes) %> +<%= text_area_tag 'notes', @notes, :cols => 60, :rows => 10, :class => 'wiki-edit' %> +<%= wikitoolbar_for 'notes' %> +
+ <%= call_hook(:view_issues_move_bottom, :issues => @issues, :target_project => @target_project, :copy => !!@copy) %> diff --git a/test/functional/issue_moves_controller_test.rb b/test/functional/issue_moves_controller_test.rb index 62593ac37..dc19ddc8d 100644 --- a/test/functional/issue_moves_controller_test.rb +++ b/test/functional/issue_moves_controller_test.rb @@ -41,8 +41,11 @@ class IssueMovesControllerTest < ActionController::TestCase end context "#create via bulk move" do - should "allow changing the issue priority" do + setup do @request.session[:user_id] = 2 + end + + should "allow changing the issue priority" do post :create, :ids => [1, 2], :priority_id => 6 assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook' @@ -50,6 +53,15 @@ class IssueMovesControllerTest < ActionController::TestCase assert_equal 6, Issue.find(2).priority_id end + + should "allow adding a note when moving" do + post :create, :ids => [1, 2], :notes => 'Moving two issues' + + assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook' + assert_equal 'Moving two issues', Issue.find(1).journals.last.notes + assert_equal 'Moving two issues', Issue.find(2).journals.last.notes + + end end