Commit cbeedec9 authored by jplang's avatar jplang

Use same logic for finding user when importing a file (#950).

git-svn-id: https://svn.redmine.org/redmine/trunk@14501 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 6f8966be
......@@ -90,7 +90,7 @@ class IssueImport < Import
end
end
if assignee_name = row_value(row, 'assigned_to')
if assignee = issue.assignable_users.detect {|u| u.name.downcase == assignee_name.downcase}
if assignee = Principal.detect_by_keyword(issue.assignable_users, assignee_name)
attributes['assigned_to_id'] = assignee.id
end
end
......
priority;subject;description;start_date;due_date;parent;private;progress;custom;version;category
High;First;First description;2015-07-08;2015-08-25;;no;;PostgreSQL;;New category
Normal;Child 1;Child description;;;1;yes;10;MySQL;2.0;New category
Normal;Child of existing issue;Child description;;;#2;no;20;;2.1;Printing
priority;subject;description;start_date;due_date;parent;private;progress;custom;version;category;user
High;First;First description;2015-07-08;2015-08-25;;no;;PostgreSQL;;New category;dlopper
Normal;Child 1;Child description;;;1;yes;10;MySQL;2.0;New category;
Normal;Child of existing issue;Child description;;;#2;no;20;;2.1;Printing;
......@@ -69,6 +69,15 @@ class IssueImportTest < ActiveSupport::TestCase
assert_equal 2, issues[2].parent_id
end
def test_assignee_should_be_set
import = generate_import_with_mapping
import.mapping.merge!('assigned_to' => '11')
import.save!
issues = new_records(Issue, 3) { import.run }
assert_equal [User.find(3), nil, nil], issues.map(&:assigned_to)
end
def test_is_private_should_be_set_based_on_user_locale
import = generate_import_with_mapping
import.mapping.merge!('is_private' => '6')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment