Project

General

Profile

Actions

Defect #7197

closed

Tracker reset to default when replying to an issue email

Added by Felix Schäfer about 13 years ago. Updated about 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Email receiving
Target version:
Start date:
2010-12-29
Due date:
% Done:

0%

Estimated time:
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

Has duplicate Redmine - Defect #7424: Email integration problem, tracker is not preservedClosed2011-01-24

Actions
Actions #1

Updated by Felix Schäfer about 13 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),
Actions #2

Updated by Jean-Philippe Lang about 13 years ago

  • Target version set to 1.1.0
Actions #3

Updated by Jean-Philippe Lang about 13 years ago

  • Resolution set to Fixed

Fixed with test in r4575.

Actions #4

Updated by Jean-Philippe Lang about 13 years ago

  • Status changed from New to Closed
Actions

Also available in: Atom PDF