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

Download (952 Bytes)

View differences:

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