summaryrefslogtreecommitdiffstats
path: root/app/models/mail_handler.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2010-11-14 13:48:01 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2010-11-14 13:48:01 +0000
commitd7cdd58db6b89711dcd38767093751aa09f19f79 (patch)
treedec932d59f6bc161884d2372d1d2145fd47ff557 /app/models/mail_handler.rb
parent97a9210483c121639ca576e91f9f6b767400fbf8 (diff)
downloadredmine-d7cdd58db6b89711dcd38767093751aa09f19f79.tar.gz
redmine-d7cdd58db6b89711dcd38767093751aa09f19f79.zip
MailHandler: ignore assignee if invalid.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4404 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/mail_handler.rb')
-rw-r--r--app/models/mail_handler.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb
index a5cf21f97..00010059f 100644
--- a/app/models/mail_handler.rb
+++ b/app/models/mail_handler.rb
@@ -253,12 +253,15 @@ class MailHandler < ActionMailer::Base
# Returns a Hash of issue attributes extracted from keywords in the email body
def issue_attributes_from_keywords(issue)
+ assigned_to = (k = get_keyword(:assigned_to, :override => true)) && find_user_from_keyword(k)
+ assigned_to = nil if assigned_to && !issue.assignable_users.include?(assigned_to)
+
{
'tracker_id' => ((k = get_keyword(:tracker)) && issue.project.trackers.find_by_name(k).try(:id)) || issue.project.trackers.find(:first).try(:id),
'status_id' => (k = get_keyword(:status)) && IssueStatus.find_by_name(k).try(:id),
'priority_id' => (k = get_keyword(:priority)) && IssuePriority.find_by_name(k).try(:id),
'category_id' => (k = get_keyword(:category)) && issue.project.issue_categories.find_by_name(k).try(:id),
- 'assigned_to_id' => (k = get_keyword(:assigned_to, :override => true)) && find_user_from_keyword(k).try(:id),
+ 'assigned_to_id' => assigned_to.try(:id),
'fixed_version_id' => (k = get_keyword(:fixed_version, :override => true)) && issue.project.shared_versions.find_by_name(k).try(:id),
'start_date' => get_keyword(:start_date, :override => true, :format => '\d{4}-\d{2}-\d{2}'),
'due_date' => get_keyword(:due_date, :override => true, :format => '\d{4}-\d{2}-\d{2}'),