Merged r11522 from trunk (#13340).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/2.3-stable@11580 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2013-03-10 12:35:20 +00:00
parent efcd602444
commit 58af20746b
4 changed files with 43 additions and 7 deletions
+14
View File
@@ -97,6 +97,7 @@ class MailHandler < ActionMailer::Base
if logger && logger.info
logger.info "MailHandler: [#{@user.login}] account created"
end
add_user_to_group(@@handler_options[:default_group])
Mailer.account_information(@user, @user.password).deliver
else
if logger && logger.error
@@ -465,6 +466,19 @@ class MailHandler < ActionMailer::Base
end
end
# Adds the newly created user to default group
def add_user_to_group(default_group)
if default_group.present?
default_group.split(',').each do |group_name|
if group = Group.named(group_name).first
group.users << @user
elsif logger
logger.warn "MailHandler: could not add user to [#{group_name}], group not found"
end
end
end
end
# Removes the email body of text after the truncation configurations.
def cleanup_body(body)
delimiters = Setting.mail_handler_body_delimiters.to_s.split(/[\r\n]+/).reject(&:blank?).map {|s| Regexp.escape(s)}