プロジェクト

全般

プロフィール

Vote #69784

完了

notes field is not propagated during issue copy

Admin Redmine さんがほぼ2年前に追加. ほぼ2年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Issues_2
対象バージョン:
開始日:
2011/04/27
期日:
進捗率:

0%

予定工数:
category_id:
2
version_id:
27
issue_org_id:
8239
author_id:
32759
assigned_to_id:
0
comments:
7
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
31
ステータス-->[Closed]

説明

scenario (vanilla installation of redmine):

  • open existing issue
  • click copy
  • add notes
  • click copy button

notes are not visible, they are lost


journals

Confirmed with demo site, I'll try to investigate further.
--------------------------------------------------------------------------------
Had a quick look yesterday evening, @Issue#new.copy_from@ does not copy current journal.

Maybe that call to @Issue#init_journal@ in @IssueMovesController@ should be moved to model after call to @#copy_from@ and only for a move action (do we really need a journal entry in a copy context if no notes are filled in) ?

--------------------------------------------------------------------------------
This change prevents double @#save@ :

<pre><code class="diff">Index: app/models/issue.rb
===================================================================
--- app/models/issue.rb (revision 5543)
+++ app/models/issue.rb (working copy)
@@ -147,10 +147,18 @@
end || false
end

- def move_to_project_without_transaction(new_project, new_tracker = nil, options = {})
+ def move_to_project_without_transaction(new_project, notes = nil, 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.instance_variable_set :@current_journal, Journal.new(:journalized => issue, :user => User.current, :notes => notes) if notes.present?
+ else
+ issue = self
+ issue.init_journal(User.current)
+ issue.current_journal.notes = notes if notes.present?
+ end
+
if new_project && issue.project_id != new_project.id
# delete issue relations
unless Setting.cross_project_issue_relations?
@@ -867,7 +875,8 @@
:prop_key => c,
:old_value => @issue_before_change.send(c),
:value => send(c)) unless send(c)==@issue_before_change.send(c)
- }
+ } if @issue_before_change
+
# custom fields changes
custom_values.each {|c|
next if (@custom_values_before_change[c.custom_field_id]==c.value ||
@@ -876,7 +885,8 @@
:prop_key => c.custom_field_id,
:old_value => @custom_values_before_change[c.custom_field_id],
:value => c.value)
- }
+ } if @custom_values_before_change
+
@current_journal.save
# reset current journal
init_journal @current_journal.user, @current_journal.notes
Index: app/controllers/issue_moves_controller.rb
===================================================================
--- app/controllers/issue_moves_controller.rb (revision 5543)
+++ 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
</code></pre>
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Less intrusive based on trunk ?
--------------------------------------------------------------------------------
This was fixed in r5602. Anything wrong with it?
--------------------------------------------------------------------------------


related_issues

relates,Closed,6901,Copy/Move an issue does not give any history of who actually did the action.

Admin Redmine さんがほぼ2年前に更新

  • カテゴリIssues_2 にセット
  • 対象バージョン1.2.0_27 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0