Defect #7197

Tracker reset to default when replying to an issue email

Added by Felix Schäfer almost 7 years ago. Updated almost 7 years ago.

Status:ClosedStart date:2010-12-29
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Email receiving
Target version:1.1.0
Resolution:Fixed Affected version:

Description

When replying to an issue email with no explicit tracker set either in the mail body or in the CLI defaults, replying to an issue per mail reverts the tracker of the issue to the "default" tracker (first tracker in list). This is caused by source:/trunk/app/models/mail_handler.rb#L260 and was introduced in r4394.


Related issues

Duplicated by Redmine - Defect #7424: Email integration problem, tracker is not preserved Closed 2011-01-24

Associated revisions

Revision 4575
Added by Jean-Philippe Lang almost 7 years ago

Fixed: Tracker reset to default when replying to an issue email (#7197).

History

#1 Updated by Felix Schäfer almost 7 years ago

This moves setting the default tracker in the email receiving method:

diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb
index 8925e4e..43eaf68 100644
--- a/app/models/mail_handler.rb
+++ b/app/models/mail_handler.rb
@@ -125,6 +125,7 @@ class MailHandler < ActionMailer::Base
     issue = Issue.new(:author => user, :project => project)
     issue.safe_attributes = issue_attributes_from_keywords(issue)
     issue.safe_attributes = {'custom_field_values' => custom_field_values_from_keywords(issue)}
+    issue.tracker ||= issue.project.trackers.find(:first)
     issue.subject = email.subject.to_s.chomp[0,255]
     if issue.subject.blank?
       issue.subject = '(no subject)'
@@ -260,7 +261,7 @@ class MailHandler < ActionMailer::Base
     assigned_to = nil if assigned_to && !issue.assignable_users.include?(assigned_to)

     {
-      'tracker_id' => ((k = get_keyword(:tracker)) && issue.project.trackers.find_by_name(k).try(:id)) || issue.project.trackers.find
+      'tracker_id' => (k = get_keyword(:tracker)) && issue.project.trackers.find_by_name(k).try(:id),
       'status_id' =>  (k = get_keyword(:status)) && IssueStatus.find_by_name(k).try(:id),
       'priority_id' => (k = get_keyword(:priority)) && IssuePriority.find_by_name(k).try(:id),
       'category_id' => (k = get_keyword(:category)) && issue.project.issue_categories.find_by_name(k).try(:id),

#2 Updated by Jean-Philippe Lang almost 7 years ago

  • Target version set to 1.1.0

#3 Updated by Jean-Philippe Lang almost 7 years ago

  • Resolution set to Fixed

Fixed with test in r4575.

#4 Updated by Jean-Philippe Lang almost 7 years ago

  • Status changed from New to Closed

Also available in: Atom PDF