Merge branch '2411-check-copyright'
[arvados.git] / services / api / app / mailers / admin_notifier.rb
index e17f4a14dab2d05f16780b09a76844401ad3cbff..87a5699f49a2061a37fd2ca3117fc0bc23ce750e 100644 (file)
@@ -1,16 +1,25 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
+
 class AdminNotifier < ActionMailer::Base
   include AbstractController::Callbacks
 
   default from: Rails.configuration.admin_notifier_email_from
-  before_filter :load_variables
 
   def new_user(user)
     @user = user
     if not Rails.configuration.new_user_notification_recipients.empty? then
       @recipients = Rails.configuration.new_user_notification_recipients
       logger.info "Sending mail to #{@recipients} about new user #{@user.uuid} (#{@user.full_name} <#{@user.email}>)"
+
+      add_to_subject = ''
+      if Rails.configuration.auto_setup_new_users
+        add_to_subject = @user.is_invited ? ' and setup' : ', but not setup'
+      end
+
       mail(to: @recipients,
-           subject: "#{Rails.configuration.email_subject_prefix}New user notification"
+           subject: "#{Rails.configuration.email_subject_prefix}New user created#{add_to_subject} notification"
           )
     end
   end
@@ -26,15 +35,4 @@ class AdminNotifier < ActionMailer::Base
     end
   end
 
-private
-  def load_variables
-    if Rails.configuration.respond_to?('workbench_address') and
-       not Rails.configuration.workbench_address.nil? and
-       not Rails.configuration.workbench_address.empty? then
-      @wb_address = Rails.configuration.workbench_address.sub(/\/$/,'') + '/users'
-    else
-      @wb_address = ''
-    end
-  end
-
 end