##// END OF EJS Templates
Ability to define a default assigned_to when receiving emails (#23020)....
Jean-Philippe Lang -
r15165:ffdcb22ccb78
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 fixed_version).each do |option|
65 %w(project status tracker category priority assigned_to 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( "--assigned-to ASSIGNEE", "assignee (username or group name)") {|v| self.issue_attributes['assigned_to'] = v}
96 opts.on( "--fixed-version VERSION","name of the target version") {|v| self.issue_attributes['fixed_version'] = v}
97 opts.on( "--fixed-version VERSION","name of the target version") {|v| self.issue_attributes['fixed_version'] = v}
97 opts.on( "--private", "create new issues as private") {|v| self.issue_attributes['is_private'] = '1'}
98 opts.on( "--private", "create new issues as private") {|v| self.issue_attributes['is_private'] = '1'}
98 opts.on("-o", "--allow-override ATTRS", "allow email content to set attributes values",
99 opts.on("-o", "--allow-override ATTRS", "allow email content to set attributes values",
@@ -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 assigned_to=ASSIGNEE assignee (username or group name)
67 fixed_version=VERSION name of the target version
68 fixed_version=VERSION name of the target version
68 private create new issues as private
69 private create new issues as private
69 allow_override=ATTRS allow email content to set attributes values
70 allow_override=ATTRS allow email content to set attributes values
@@ -140,6 +140,17 class MailHandlerTest < ActiveSupport::TestCase
140 assert_equal 'Alpha', issue.reload.fixed_version.name
140 assert_equal 'Alpha', issue.reload.fixed_version.name
141 end
141 end
142
142
143 def test_add_issue_with_default_assigned_to
144 # This email contains: 'Project: onlinestore'
145 issue = submit_email(
146 'ticket_on_given_project.eml',
147 :issue => {:assigned_to => 'jsmith'}
148 )
149 assert issue.is_a?(Issue)
150 assert !issue.new_record?
151 assert_equal 'jsmith', issue.reload.assigned_to.login
152 end
153
143 def test_add_issue_with_status_override
154 def test_add_issue_with_status_override
144 # This email contains: 'Project: onlinestore' and 'Status: Resolved'
155 # This email contains: 'Project: onlinestore' and 'Status: Resolved'
145 issue = submit_email('ticket_on_given_project.eml', :allow_override => ['status'])
156 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