@@ -31,7 +31,7 class MailHandler < ActionMailer::Base | |||
|
31 | 31 | @@handler_options[:allow_override] ||= [] |
|
32 | 32 | # Project needs to be overridable if not specified |
|
33 | 33 | @@handler_options[:allow_override] << 'project' unless @@handler_options[:issue].has_key?(:project) |
|
34 |
# Status |
|
|
34 | # Status overridable by default | |
|
35 | 35 | @@handler_options[:allow_override] << 'status' unless @@handler_options[:issue].has_key?(:status) |
|
36 | 36 | super email |
|
37 | 37 | end |
@@ -78,11 +78,15 class MailHandler < ActionMailer::Base | |||
|
78 | 78 | tracker = (get_keyword(:tracker) && project.trackers.find_by_name(get_keyword(:tracker))) || project.trackers.find(:first) |
|
79 | 79 | category = (get_keyword(:category) && project.issue_categories.find_by_name(get_keyword(:category))) |
|
80 | 80 | priority = (get_keyword(:priority) && Enumeration.find_by_opt_and_name('IPRI', get_keyword(:priority))) |
|
81 |
status = (get_keyword(:status) && IssueStatus.find_by_name(get_keyword(:status))) |
|
|
81 | status = (get_keyword(:status) && IssueStatus.find_by_name(get_keyword(:status))) | |
|
82 | 82 | |
|
83 | 83 | # check permission |
|
84 | 84 | raise UnauthorizedAction unless user.allowed_to?(:add_issues, project) |
|
85 |
issue = Issue.new(:author => user, :project => project, :tracker => tracker, :category => category, :priority => priority |
|
|
85 | issue = Issue.new(:author => user, :project => project, :tracker => tracker, :category => category, :priority => priority) | |
|
86 | # check workflow | |
|
87 | if status && issue.new_statuses_allowed_to(user).include?(status) | |
|
88 | issue.status = status | |
|
89 | end | |
|
86 | 90 | issue.subject = email.subject.chomp.toutf8 |
|
87 | 91 | issue.description = email.plain_text_body.chomp |
|
88 | 92 | issue.save! |
@@ -114,7 +118,10 class MailHandler < ActionMailer::Base | |||
|
114 | 118 | # add the note |
|
115 | 119 | journal = issue.init_journal(user, email.plain_text_body.chomp) |
|
116 | 120 | add_attachments(issue) |
|
117 | issue.status = status unless status.nil? | |
|
121 | # check workflow | |
|
122 | if status && issue.new_statuses_allowed_to(user).include?(status) | |
|
123 | issue.status = status | |
|
124 | end | |
|
118 | 125 | issue.save! |
|
119 | 126 | logger.info "MailHandler: issue ##{issue.id} updated by #{user}" if logger && logger.info |
|
120 | 127 | Mailer.deliver_issue_edit(journal) if Setting.notified_events.include?('issue_updated') |
General Comments 0
You need to be logged in to leave comments.
Login now