@@ -31,7 +31,7 class MailHandler < ActionMailer::Base | |||||
31 | @@handler_options[:allow_override] ||= [] |
|
31 | @@handler_options[:allow_override] ||= [] | |
32 | # Project needs to be overridable if not specified |
|
32 | # Project needs to be overridable if not specified | |
33 | @@handler_options[:allow_override] << 'project' unless @@handler_options[:issue].has_key?(:project) |
|
33 | @@handler_options[:allow_override] << 'project' unless @@handler_options[:issue].has_key?(:project) | |
34 |
# Status |
|
34 | # Status overridable by default | |
35 | @@handler_options[:allow_override] << 'status' unless @@handler_options[:issue].has_key?(:status) |
|
35 | @@handler_options[:allow_override] << 'status' unless @@handler_options[:issue].has_key?(:status) | |
36 | super email |
|
36 | super email | |
37 | end |
|
37 | end | |
@@ -78,11 +78,15 class MailHandler < ActionMailer::Base | |||||
78 | tracker = (get_keyword(:tracker) && project.trackers.find_by_name(get_keyword(:tracker))) || project.trackers.find(:first) |
|
78 | tracker = (get_keyword(:tracker) && project.trackers.find_by_name(get_keyword(:tracker))) || project.trackers.find(:first) | |
79 | category = (get_keyword(:category) && project.issue_categories.find_by_name(get_keyword(:category))) |
|
79 | category = (get_keyword(:category) && project.issue_categories.find_by_name(get_keyword(:category))) | |
80 | priority = (get_keyword(:priority) && Enumeration.find_by_opt_and_name('IPRI', get_keyword(:priority))) |
|
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 | # check permission |
|
83 | # check permission | |
84 | raise UnauthorizedAction unless user.allowed_to?(:add_issues, project) |
|
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 | issue.subject = email.subject.chomp.toutf8 |
|
90 | issue.subject = email.subject.chomp.toutf8 | |
87 | issue.description = email.plain_text_body.chomp |
|
91 | issue.description = email.plain_text_body.chomp | |
88 | issue.save! |
|
92 | issue.save! | |
@@ -114,7 +118,10 class MailHandler < ActionMailer::Base | |||||
114 | # add the note |
|
118 | # add the note | |
115 | journal = issue.init_journal(user, email.plain_text_body.chomp) |
|
119 | journal = issue.init_journal(user, email.plain_text_body.chomp) | |
116 | add_attachments(issue) |
|
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 | issue.save! |
|
125 | issue.save! | |
119 | logger.info "MailHandler: issue ##{issue.id} updated by #{user}" if logger && logger.info |
|
126 | logger.info "MailHandler: issue ##{issue.id} updated by #{user}" if logger && logger.info | |
120 | Mailer.deliver_issue_edit(journal) if Setting.notified_events.include?('issue_updated') |
|
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