Merge branch 'master' into 2681-new-inactive-user-notification
[arvados.git] / services / api / app / mailers / admin_notifier.rb
1 class AdminNotifier < ActionMailer::Base
2   default from: Rails.configuration.admin_notifier_email_from
3
4   def new_user(user)
5     @user = user
6     if not Rails.configuration.new_user_notification_recipients.empty? then
7       @recipients = Rails.configuration.new_user_notification_recipients
8       logger.info "Sending mail to #{@recipients} about new user #{@user.uuid} (#{@user.full_name} <#{@user.email}>)"
9       mail(to: @recipients,
10            subject: "#{Rails.configuration.email_subject_prefix}New user notification"
11           )
12     end
13   end
14
15   def new_inactive_user(user)
16     @user = user
17     if not Rails.configuration.new_inactive_user_notification_recipients.empty? then
18       @recipients = Rails.configuration.new_inactive_user_notification_recipients
19       logger.info "Sending mail to #{@recipients} about new user #{@user.uuid} (#{@user.full_name} <#{@user.email}>)"
20       mail(to: @recipients,
21            subject: "#{Rails.configuration.email_subject_prefix}New inactive user notification"
22           )
23     end
24   end
25
26 end