1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-12-19 15:01:14 +00:00

Allow setting "Parent issue" attribute in emails (#27070).

Patch by Mizuki ISHIKAWA.


git-svn-id: http://svn.redmine.org/redmine/trunk@17304 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA 2018-04-24 02:40:21 +00:00
parent fe7e8f1d3b
commit a9bf2b763c
3 changed files with 8 additions and 2 deletions

View File

@ -429,7 +429,8 @@ class MailHandler < ActionMailer::Base
'start_date' => get_keyword(:start_date, :format => '\d{4}-\d{2}-\d{2}'), 'start_date' => get_keyword(:start_date, :format => '\d{4}-\d{2}-\d{2}'),
'due_date' => get_keyword(:due_date, :format => '\d{4}-\d{2}-\d{2}'), 'due_date' => get_keyword(:due_date, :format => '\d{4}-\d{2}-\d{2}'),
'estimated_hours' => get_keyword(:estimated_hours), 'estimated_hours' => get_keyword(:estimated_hours),
'done_ratio' => get_keyword(:done_ratio, :format => '(\d|10)?0') 'done_ratio' => get_keyword(:done_ratio, :format => '(\d|10)?0'),
'parent_issue_id' => get_keyword(:parent_issue)
}.delete_if {|k, v| v.blank? } }.delete_if {|k, v| v.blank? }
attrs attrs

View File

@ -38,6 +38,7 @@ Assigned to: John Smith
fixed version: alpha fixed version: alpha
estimated hours: 2.5 estimated hours: 2.5
done ratio: 30 done ratio: 30
parent issue: 1
--- This line starts with a delimiter and should not be stripped --- This line starts with a delimiter and should not be stripped

View File

@ -43,7 +43,7 @@ class MailHandlerTest < ActiveSupport::TestCase
def test_add_issue_with_specific_overrides def test_add_issue_with_specific_overrides
issue = submit_email('ticket_on_given_project.eml', issue = submit_email('ticket_on_given_project.eml',
:allow_override => ['status', 'start_date', 'due_date', 'assigned_to', :allow_override => ['status', 'start_date', 'due_date', 'assigned_to',
'fixed_version', 'estimated_hours', 'done_ratio'] 'fixed_version', 'estimated_hours', 'done_ratio', 'parent_issue']
) )
assert issue.is_a?(Issue) assert issue.is_a?(Issue)
assert !issue.new_record? assert !issue.new_record?
@ -60,6 +60,7 @@ class MailHandlerTest < ActiveSupport::TestCase
assert_equal Version.find_by_name('Alpha'), issue.fixed_version assert_equal Version.find_by_name('Alpha'), issue.fixed_version
assert_equal 2.5, issue.estimated_hours assert_equal 2.5, issue.estimated_hours
assert_equal 30, issue.done_ratio assert_equal 30, issue.done_ratio
assert_equal Issue.find(4), issue.parent
# keywords should be removed from the email body # keywords should be removed from the email body
assert !issue.description.match(/^Project:/i) assert !issue.description.match(/^Project:/i)
assert !issue.description.match(/^Status:/i) assert !issue.description.match(/^Status:/i)
@ -81,6 +82,7 @@ class MailHandlerTest < ActiveSupport::TestCase
assert_equal Version.find_by_name('Alpha'), issue.fixed_version assert_equal Version.find_by_name('Alpha'), issue.fixed_version
assert_equal 2.5, issue.estimated_hours assert_equal 2.5, issue.estimated_hours
assert_equal 30, issue.done_ratio assert_equal 30, issue.done_ratio
assert_equal Issue.find(4), issue.parent
end end
def test_add_issue_without_overrides_should_ignore_attributes def test_add_issue_without_overrides_should_ignore_attributes
@ -102,6 +104,7 @@ class MailHandlerTest < ActiveSupport::TestCase
assert_nil issue.fixed_version assert_nil issue.fixed_version
assert_nil issue.estimated_hours assert_nil issue.estimated_hours
assert_equal 0, issue.done_ratio assert_equal 0, issue.done_ratio
assert_nil issue.parent
end end
def test_add_issue_to_project_specified_by_subaddress def test_add_issue_to_project_specified_by_subaddress
@ -474,6 +477,7 @@ class MailHandlerTest < ActiveSupport::TestCase
assert_nil issue.start_date assert_nil issue.start_date
assert_nil issue.due_date assert_nil issue.due_date
assert_equal 0, issue.done_ratio assert_equal 0, issue.done_ratio
assert_nil issue.parent
assert_equal 'Normal', issue.priority.to_s assert_equal 'Normal', issue.priority.to_s
assert issue.description.include?('Lorem ipsum dolor sit amet, consectetuer adipiscing elit.') assert issue.description.include?('Lorem ipsum dolor sit amet, consectetuer adipiscing elit.')
end end