summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/mail_handler.rb2
-rw-r--r--extra/mail_handler/rdm-mailhandler.rb1
-rw-r--r--lib/tasks/email.rake1
-rw-r--r--test/unit/mail_handler_test.rb11
4 files changed, 14 insertions, 1 deletions
diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb
index e016dacfe..99462179e 100644
--- a/app/models/mail_handler.rb
+++ b/app/models/mail_handler.rb
@@ -62,7 +62,7 @@ class MailHandler < ActionMailer::Base
# Use when receiving emails with rake tasks
def self.extract_options_from_env(env)
options = {:issue => {}}
- %w(project status tracker category priority).each do |option|
+ %w(project status tracker category priority fixed_version).each do |option|
options[:issue][option.to_sym] = env[option] if env[option]
end
%w(allow_override unknown_user no_permission_check no_account_notice default_group project_from_subaddress).each do |option|
diff --git a/extra/mail_handler/rdm-mailhandler.rb b/extra/mail_handler/rdm-mailhandler.rb
index a604355f1..d1cf130d7 100644
--- a/extra/mail_handler/rdm-mailhandler.rb
+++ b/extra/mail_handler/rdm-mailhandler.rb
@@ -93,6 +93,7 @@ class RedmineMailHandler
opts.on("-t", "--tracker TRACKER", "name of the target tracker") {|v| self.issue_attributes['tracker'] = v}
opts.on( "--category CATEGORY", "name of the target category") {|v| self.issue_attributes['category'] = v}
opts.on( "--priority PRIORITY", "name of the target priority") {|v| self.issue_attributes['priority'] = v}
+ opts.on( "--fixed-version VERSION","name of the target version") {|v| self.issue_attributes['fixed_version'] = v}
opts.on( "--private", "create new issues as private") {|v| self.issue_attributes['is_private'] = '1'}
opts.on("-o", "--allow-override ATTRS", "allow email content to set attributes values",
"ATTRS is a comma separated list of attributes",
diff --git a/lib/tasks/email.rake b/lib/tasks/email.rake
index 51ca25b2e..43fa68736 100644
--- a/lib/tasks/email.rake
+++ b/lib/tasks/email.rake
@@ -64,6 +64,7 @@ Issue attributes control options:
tracker=TRACKER name of the target tracker
category=CATEGORY name of the target category
priority=PRIORITY name of the target priority
+ fixed_version=VERSION name of the target version
private create new issues as private
allow_override=ATTRS allow email content to set attributes values
ATTRS is a comma separated list of attributes
diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb
index 1ec35adce..e2522db26 100644
--- a/test/unit/mail_handler_test.rb
+++ b/test/unit/mail_handler_test.rb
@@ -129,6 +129,17 @@ class MailHandlerTest < ActiveSupport::TestCase
assert_equal 'Support request', issue.tracker.name
end
+ def test_add_issue_with_default_version
+ # This email contains: 'Project: onlinestore'
+ issue = submit_email(
+ 'ticket_on_given_project.eml',
+ :issue => {:fixed_version => 'Alpha'}
+ )
+ assert issue.is_a?(Issue)
+ assert !issue.new_record?
+ assert_equal 'Alpha', issue.reload.fixed_version.name
+ end
+
def test_add_issue_with_status_override
# This email contains: 'Project: onlinestore' and 'Status: Resolved'
issue = submit_email('ticket_on_given_project.eml', :allow_override => ['status'])