@@ -253,12 +253,15 class MailHandler < ActionMailer::Base | |||
|
253 | 253 | |
|
254 | 254 | # Returns a Hash of issue attributes extracted from keywords in the email body |
|
255 | 255 | def issue_attributes_from_keywords(issue) |
|
256 | assigned_to = (k = get_keyword(:assigned_to, :override => true)) && find_user_from_keyword(k) | |
|
257 | assigned_to = nil if assigned_to && !issue.assignable_users.include?(assigned_to) | |
|
258 | ||
|
256 | 259 | { |
|
257 | 260 | 'tracker_id' => ((k = get_keyword(:tracker)) && issue.project.trackers.find_by_name(k).try(:id)) || issue.project.trackers.find(:first).try(:id), |
|
258 | 261 | 'status_id' => (k = get_keyword(:status)) && IssueStatus.find_by_name(k).try(:id), |
|
259 | 262 | 'priority_id' => (k = get_keyword(:priority)) && IssuePriority.find_by_name(k).try(:id), |
|
260 | 263 | 'category_id' => (k = get_keyword(:category)) && issue.project.issue_categories.find_by_name(k).try(:id), |
|
261 | 'assigned_to_id' => (k = get_keyword(:assigned_to, :override => true)) && find_user_from_keyword(k).try(:id), | |
|
264 | 'assigned_to_id' => assigned_to.try(:id), | |
|
262 | 265 | 'fixed_version_id' => (k = get_keyword(:fixed_version, :override => true)) && issue.project.shared_versions.find_by_name(k).try(:id), |
|
263 | 266 | 'start_date' => get_keyword(:start_date, :override => true, :format => '\d{4}-\d{2}-\d{2}'), |
|
264 | 267 | 'due_date' => get_keyword(:due_date, :override => true, :format => '\d{4}-\d{2}-\d{2}'), |
@@ -40,6 +40,7 pulvinar dui, a gravida orci mi eget odio. Nunc a lacus. | |||
|
40 | 40 | Project: onlinestore |
|
41 | 41 | Tracker: Feature request |
|
42 | 42 | category: Stock management |
|
43 | assigned to: miscuser9@foo.bar | |
|
43 | 44 | priority: foo |
|
44 | 45 | done ratio: x |
|
45 | 46 | start date: some day |
@@ -25,6 +25,7 class MailHandlerTest < ActiveSupport::TestCase | |||
|
25 | 25 | :roles, |
|
26 | 26 | :members, |
|
27 | 27 | :member_roles, |
|
28 | :users, | |
|
28 | 29 | :issues, |
|
29 | 30 | :issue_statuses, |
|
30 | 31 | :workflows, |
@@ -234,6 +235,7 class MailHandlerTest < ActiveSupport::TestCase | |||
|
234 | 235 | assert issue.is_a?(Issue) |
|
235 | 236 | assert !issue.new_record? |
|
236 | 237 | issue.reload |
|
238 | assert_nil issue.assigned_to | |
|
237 | 239 | assert_nil issue.start_date |
|
238 | 240 | assert_nil issue.due_date |
|
239 | 241 | assert_equal 0, issue.done_ratio |
General Comments 0
You need to be logged in to leave comments.
Login now