@@handler_options[:allow_override] ||= []
# Project needs to be overridable if not specified
@@handler_options[:allow_override] << 'project' unless @@handler_options[:issue].has_key?(:project)
- # Status needs to be overridable if not specified
+ # Status overridable by default
@@handler_options[:allow_override] << 'status' unless @@handler_options[:issue].has_key?(:status)
super email
end
tracker = (get_keyword(:tracker) && project.trackers.find_by_name(get_keyword(:tracker))) || project.trackers.find(:first)
category = (get_keyword(:category) && project.issue_categories.find_by_name(get_keyword(:category)))
priority = (get_keyword(:priority) && Enumeration.find_by_opt_and_name('IPRI', get_keyword(:priority)))
- status = (get_keyword(:status) && IssueStatus.find_by_name(get_keyword(:status))) || IssueStatus.default
+ status = (get_keyword(:status) && IssueStatus.find_by_name(get_keyword(:status)))
# check permission
raise UnauthorizedAction unless user.allowed_to?(:add_issues, project)
- issue = Issue.new(:author => user, :project => project, :tracker => tracker, :category => category, :priority => priority, :status => status)
+ issue = Issue.new(:author => user, :project => project, :tracker => tracker, :category => category, :priority => priority)
+ # check workflow
+ if status && issue.new_statuses_allowed_to(user).include?(status)
+ issue.status = status
+ end
issue.subject = email.subject.chomp.toutf8
issue.description = email.plain_text_body.chomp
issue.save!
# add the note
journal = issue.init_journal(user, email.plain_text_body.chomp)
add_attachments(issue)
- issue.status = status unless status.nil?
+ # check workflow
+ if status && issue.new_statuses_allowed_to(user).include?(status)
+ issue.status = status
+ end
issue.save!
logger.info "MailHandler: issue ##{issue.id} updated by #{user}" if logger && logger.info
Mailer.deliver_issue_edit(journal) if Setting.notified_events.include?('issue_updated')