@@ -468,7 +468,7 class MailHandler < ActionMailer::Base | |||
|
468 | 468 | } |
|
469 | 469 | end |
|
470 | 470 | if assignee.nil? |
|
471 |
assignee ||= assignable.detect {|a| a. |
|
|
471 | assignee ||= assignable.detect {|a| a.name.downcase == keyword} | |
|
472 | 472 | end |
|
473 | 473 | assignee |
|
474 | 474 | end |
@@ -12,7 +12,8 module ObjectHelpers | |||
|
12 | 12 | user |
|
13 | 13 | end |
|
14 | 14 | |
|
15 | def User.add_to_project(user, project, roles) | |
|
15 | def User.add_to_project(user, project, roles=nil) | |
|
16 | roles = Role.find(1) if roles.nil? | |
|
16 | 17 | roles = [roles] unless roles.is_a?(Array) |
|
17 | 18 | Member.create!(:principal => user, :project => project, :roles => roles) |
|
18 | 19 | end |
@@ -194,6 +194,16 class MailHandlerTest < ActiveSupport::TestCase | |||
|
194 | 194 | assert_equal '2', issue.custom_field_value(field) |
|
195 | 195 | end |
|
196 | 196 | |
|
197 | def test_add_issue_should_match_assignee_on_display_name | |
|
198 | user = User.generate!(:firstname => 'Foo Bar', :lastname => 'Foo Baz') | |
|
199 | User.add_to_project(user, Project.find(2)) | |
|
200 | issue = submit_email('ticket_on_given_project.eml') do |email| | |
|
201 | email.sub!(/^Assigned to.*$/, 'Assigned to: Foo Bar Foo baz') | |
|
202 | end | |
|
203 | assert issue.is_a?(Issue) | |
|
204 | assert_equal user, issue.assigned_to | |
|
205 | end | |
|
206 | ||
|
197 | 207 | def test_add_issue_with_cc |
|
198 | 208 | issue = submit_email('ticket_with_cc.eml', :issue => {:project => 'ecookbook'}) |
|
199 | 209 | assert issue.is_a?(Issue) |
General Comments 0
You need to be logged in to leave comments.
Login now