summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-06-18 10:57:22 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-06-18 10:57:22 +0000
commit11b7b573df3db5291518b0d11518a12e0ba60ed6 (patch)
tree6b1bf99a24e089f68becd9269e0662fce5662ad7
parent60b9ea8945d59465fe41a92c5575c3f3bca12179 (diff)
downloadredmine-11b7b573df3db5291518b0d11518a12e0ba60ed6.tar.gz
redmine-11b7b573df3db5291518b0d11518a12e0ba60ed6.zip
Merged r15547 and r15561 (#23020).
git-svn-id: http://svn.redmine.org/redmine/branches/3.3-stable@15566 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/mail_handler.rb2
-rw-r--r--app/views/mail_handler/new.html.erb2
-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
5 files changed, 16 insertions, 1 deletions
diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb
index a619f115d..28841310e 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 fixed_version).each do |option|
+ %w(project status tracker category priority assigned_to 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/app/views/mail_handler/new.html.erb b/app/views/mail_handler/new.html.erb
index a9d069650..25cf05bae 100644
--- a/app/views/mail_handler/new.html.erb
+++ b/app/views/mail_handler/new.html.erb
@@ -33,6 +33,8 @@
<label>tracker: <%= text_field_tag 'issue[tracker]' %></label>
<label>category: <%= text_field_tag 'issue[category]' %></label>
<label>priority: <%= text_field_tag 'issue[priority]' %></label>
+ <label>assigned_to: <%= text_field_tag 'issue[assigned_to]' %></label>
+ <label>fixed_version: <%= text_field_tag 'issue[fixed_version]' %></label>
<label>private: <%= check_box_tag 'issue[private]', 1 %></label>
<label>allow_override: <%= text_field_tag 'allow_override' %></label>
</fieldset>
diff --git a/extra/mail_handler/rdm-mailhandler.rb b/extra/mail_handler/rdm-mailhandler.rb
index 7784f48dd..4a74df15a 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( "--assigned-to ASSIGNEE", "assignee (username or group name)") {|v| self.issue_attributes['assigned_to'] = 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",
diff --git a/lib/tasks/email.rake b/lib/tasks/email.rake
index fe6fb92ab..1b62abb23 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
+ assigned_to=ASSIGNEE assignee (username or group name)
fixed_version=VERSION name of the target version
private create new issues as private
allow_override=ATTRS allow email content to set attributes values
diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb
index f08f2a6cd..07d579a5d 100644
--- a/test/unit/mail_handler_test.rb
+++ b/test/unit/mail_handler_test.rb
@@ -140,6 +140,17 @@ class MailHandlerTest < ActiveSupport::TestCase
assert_equal 'Alpha', issue.reload.fixed_version.name
end
+ def test_add_issue_with_default_assigned_to
+ # This email contains: 'Project: onlinestore'
+ issue = submit_email(
+ 'ticket_on_given_project.eml',
+ :issue => {:assigned_to => 'jsmith'}
+ )
+ assert issue.is_a?(Issue)
+ assert !issue.new_record?
+ assert_equal 'jsmith', issue.reload.assigned_to.login
+ 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'])