##// END OF EJS Templates
Allow a default version to be set on the command line for incoming emails (#7346)....
Jean-Philippe Lang -
r14407:0df7fa714b42
parent child
Show More
@@ -62,7 +62,7 class MailHandler < ActionMailer::Base
62 # Use when receiving emails with rake tasks
62 # Use when receiving emails with rake tasks
63 def self.extract_options_from_env(env)
63 def self.extract_options_from_env(env)
64 options = {:issue => {}}
64 options = {:issue => {}}
65 %w(project status tracker category priority).each do |option|
65 %w(project status tracker category priority fixed_version).each do |option|
66 options[:issue][option.to_sym] = env[option] if env[option]
66 options[:issue][option.to_sym] = env[option] if env[option]
67 end
67 end
68 %w(allow_override unknown_user no_permission_check no_account_notice default_group project_from_subaddress).each do |option|
68 %w(allow_override unknown_user no_permission_check no_account_notice default_group project_from_subaddress).each do |option|
@@ -93,6 +93,7 class RedmineMailHandler
93 opts.on("-t", "--tracker TRACKER", "name of the target tracker") {|v| self.issue_attributes['tracker'] = v}
93 opts.on("-t", "--tracker TRACKER", "name of the target tracker") {|v| self.issue_attributes['tracker'] = v}
94 opts.on( "--category CATEGORY", "name of the target category") {|v| self.issue_attributes['category'] = v}
94 opts.on( "--category CATEGORY", "name of the target category") {|v| self.issue_attributes['category'] = v}
95 opts.on( "--priority PRIORITY", "name of the target priority") {|v| self.issue_attributes['priority'] = v}
95 opts.on( "--priority PRIORITY", "name of the target priority") {|v| self.issue_attributes['priority'] = v}
96 opts.on( "--fixed-version VERSION","name of the target version") {|v| self.issue_attributes['fixed_version'] = v}
96 opts.on( "--private", "create new issues as private") {|v| self.issue_attributes['is_private'] = '1'}
97 opts.on( "--private", "create new issues as private") {|v| self.issue_attributes['is_private'] = '1'}
97 opts.on("-o", "--allow-override ATTRS", "allow email content to set attributes values",
98 opts.on("-o", "--allow-override ATTRS", "allow email content to set attributes values",
98 "ATTRS is a comma separated list of attributes",
99 "ATTRS is a comma separated list of attributes",
@@ -64,6 +64,7 Issue attributes control options:
64 tracker=TRACKER name of the target tracker
64 tracker=TRACKER name of the target tracker
65 category=CATEGORY name of the target category
65 category=CATEGORY name of the target category
66 priority=PRIORITY name of the target priority
66 priority=PRIORITY name of the target priority
67 fixed_version=VERSION name of the target version
67 private create new issues as private
68 private create new issues as private
68 allow_override=ATTRS allow email content to set attributes values
69 allow_override=ATTRS allow email content to set attributes values
69 ATTRS is a comma separated list of attributes
70 ATTRS is a comma separated list of attributes
@@ -129,6 +129,17 class MailHandlerTest < ActiveSupport::TestCase
129 assert_equal 'Support request', issue.tracker.name
129 assert_equal 'Support request', issue.tracker.name
130 end
130 end
131
131
132 def test_add_issue_with_default_version
133 # This email contains: 'Project: onlinestore'
134 issue = submit_email(
135 'ticket_on_given_project.eml',
136 :issue => {:fixed_version => 'Alpha'}
137 )
138 assert issue.is_a?(Issue)
139 assert !issue.new_record?
140 assert_equal 'Alpha', issue.reload.fixed_version.name
141 end
142
132 def test_add_issue_with_status_override
143 def test_add_issue_with_status_override
133 # This email contains: 'Project: onlinestore' and 'Status: Resolved'
144 # This email contains: 'Project: onlinestore' and 'Status: Resolved'
134 issue = submit_email('ticket_on_given_project.eml', :allow_override => ['status'])
145 issue = submit_email('ticket_on_given_project.eml', :allow_override => ['status'])
General Comments 0
You need to be logged in to leave comments. Login now