Project

General

Profile

Patch #4662 ยป redmine_ted_at_tedb_dot_us_assign_email_2010-01-26.patch

Patch to app/models/mail_handler.rb - Ted Behling, 2010-01-27 03:58

View differences:

app/models/mail_handler.rb 2010-01-26 21:02:27.464719101 -0500
def receive(email)
@email = email
@user = User.active.find(:first, :conditions => ["LOWER(mail) = ?", email.from.to_a.first.to_s.strip.downcase])
@to_user = User.active.find(:first, :conditions => ["LOWER(mail) = ?", email.to.to_a.first.to_s.strip.downcase])
unless @user
# Unknown user => the email is ignored
# TODO: ability to create the user's account
......
# check permission
raise UnauthorizedAction unless user.allowed_to?(:add_issues, project)
issue = Issue.new(:author => user, :project => project, :tracker => tracker, :category => category, :priority => priority)
issue.assigned_to = @to_user
# check workflow
if status && issue.new_statuses_allowed_to(user).include?(status)
issue.status = status
    (1-1/1)