forked from External/greenlight
GRN2-6: Notify admins when a approve/invite user signs up (#538)
* Notify admins when a approve/invite user signs up * Fix formating * Uses admins_url variable
This commit is contained in:
committed by
Jesus Federico
parent
83a9edf81d
commit
f88d67f6fb
@ -49,6 +49,14 @@ module Emailer
|
||||
UserMailer.approve_user(user, root_url, logo_image, user_color).deliver_now
|
||||
end
|
||||
|
||||
def send_approval_user_signup_email(user)
|
||||
UserMailer.approval_user_signup(user, admins_url, logo_image, user_color, admin_emails).deliver_now
|
||||
end
|
||||
|
||||
def send_invite_user_signup_email(user)
|
||||
UserMailer.invite_user_signup(user, admins_url, logo_image, user_color, admin_emails).deliver_now
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Returns the link the user needs to click to verify their account
|
||||
@ -56,6 +64,17 @@ module Emailer
|
||||
edit_account_activation_url(token: @user.activation_token, email: @user.email)
|
||||
end
|
||||
|
||||
def admin_emails
|
||||
admins = User.with_role(:admin)
|
||||
|
||||
if Rails.configuration.loadbalanced_configuration
|
||||
admins = admins.without_role(:super_admin)
|
||||
.where(provider: user_settings_provider)
|
||||
end
|
||||
|
||||
admins.collect(&:email).join(",")
|
||||
end
|
||||
|
||||
def reset_link
|
||||
edit_password_reset_url(@user.reset_token, email: @user.email)
|
||||
end
|
||||
|
Reference in New Issue
Block a user