mirror of
https://github.com/meineerde/redmine.git
synced 2026-02-05 16:43:25 +00:00
Allow sending account information when importing users (#35365).
Patch by Yuichi HARADA. git-svn-id: http://svn.redmine.org/redmine/trunk@21058 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
504e9f3489
commit
41b22756d2
@ -115,4 +115,8 @@ class UserImport < Import
|
||||
object.send(:safe_attributes=, attributes, user)
|
||||
object
|
||||
end
|
||||
|
||||
def extend_object(row, item, object)
|
||||
Mailer.deliver_account_information(object, object.password) if yes?(settings['notifications'])
|
||||
end
|
||||
end
|
||||
|
||||
@ -130,6 +130,24 @@ class UserImportTest < ActiveSupport::TestCase
|
||||
assert_equal '666-7777-8888', third.custom_field_value(phone_number_cf)
|
||||
end
|
||||
|
||||
def test_deliver_account_information
|
||||
import = generate_import_with_mapping
|
||||
import.settings['notifications'] = '1'
|
||||
%w(admin language auth_source).each do |key|
|
||||
import.settings['mapping'].delete(key)
|
||||
end
|
||||
import.save!
|
||||
|
||||
ActionMailer::Base.deliveries.clear
|
||||
first, = new_records(User, 3){import.run}
|
||||
assert_equal 3, ActionMailer::Base.deliveries.size
|
||||
|
||||
mail = ActionMailer::Base.deliveries.first
|
||||
assert_equal 'Your Redmine account activation', mail.subject
|
||||
assert_equal 'user1', first.login
|
||||
assert_mail_body_match "Login: #{first.login}", mail
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def generate_import(fixture_name='import_users.csv')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user