Index: app/controllers/issue_moves_controller.rb =================================================================== --- app/controllers/issue_moves_controller.rb (revision 5881) +++ app/controllers/issue_moves_controller.rb (working copy) @@ -17,10 +17,8 @@ moved_issues = [] @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)}) + if r = issue.move_to_project(@target_project, @notes, new_tracker, {:copy => @copy, :attributes => extract_changed_attributes_for_move(params)}) moved_issues << r else unsaved_issue_ids << issue.id Index: app/models/issue.rb =================================================================== --- app/models/issue.rb (revision 5881) +++ app/models/issue.rb (working copy) @@ -146,10 +146,17 @@ move_to_project_without_transaction(*args) || raise(ActiveRecord::Rollback) end || false end - - def move_to_project_without_transaction(new_project, new_tracker = nil, options = {}) + + def move_to_project_without_transaction(new_project, notes = '', new_tracker = nil, options = {}) options ||= {} - issue = options[:copy] ? self.class.new.copy_from(self) : self + + if options[:copy] + issue = self.class.new.copy_from(self) + issue.init_journal(User.current, notes, false) if notes.present? + else + issue = self + issue.init_journal(User.current, notes) + end if new_project && issue.project_id != new_project.id # delete issue relations @@ -188,13 +195,7 @@ issue.attributes = options[:attributes] end if issue.save - if options[:copy] - if current_journal && current_journal.notes.present? - issue.init_journal(current_journal.user, current_journal.notes) - issue.current_journal.notify = false - issue.save - end - else + unless options[:copy] # Manually update project_id on related time entries TimeEntry.update_all("project_id = #{new_project.id}", {:issue_id => id}) @@ -381,8 +382,9 @@ end end - def init_journal(user, notes = "") + def init_journal(user, notes = '', notify_on_save = true) @current_journal ||= Journal.new(:journalized => self, :user => user, :notes => notes) + @current_journal.notify = notify_on_save @issue_before_change = self.clone @issue_before_change.status = self.status @custom_values_before_change = {}