summaryrefslogtreecommitdiff
path: root/app/mailers
diff options
context:
space:
mode:
Diffstat (limited to 'app/mailers')
-rw-r--r--app/mailers/devise_mailer.rb4
-rw-r--r--app/mailers/emails/members.rb40
-rw-r--r--app/mailers/emails/profile.rb10
3 files changed, 48 insertions, 6 deletions
diff --git a/app/mailers/devise_mailer.rb b/app/mailers/devise_mailer.rb
index cbaf53fced1..a02670aed90 100644
--- a/app/mailers/devise_mailer.rb
+++ b/app/mailers/devise_mailer.rb
@@ -9,6 +9,10 @@ class DeviseMailer < Devise::Mailer
helper EmailsHelper
helper ApplicationHelper
+ def password_change_by_admin(record, opts = {})
+ devise_mail(record, :password_change_by_admin, opts)
+ end
+
protected
def subject_for(key)
diff --git a/app/mailers/emails/members.rb b/app/mailers/emails/members.rb
index 07ce9bba784..3a13c5949bd 100644
--- a/app/mailers/emails/members.rb
+++ b/app/mailers/emails/members.rb
@@ -51,9 +51,32 @@ module Emails
return unless member_exists?
- member_email_with_layout(
- to: member.invite_email,
- subject: subject("Invitation to join the #{member_source.human_name} #{member_source.model_name.singular}"))
+ subject_line = subject("Invitation to join the #{member_source.human_name} #{member_source.model_name.singular}")
+
+ if member.invite_to_unknown_user? && Feature.enabled?(:invite_email_experiment)
+ subject_line = subject("#{member.created_by.name} invited you to join GitLab") if member.created_by
+ @invite_url_params = { new_user_invite: 'experiment' }
+
+ member_email_with_layout(
+ to: member.invite_email,
+ subject: subject_line,
+ template: 'member_invited_email_experiment',
+ layout: 'experiment_mailer'
+ )
+
+ Gitlab::Tracking.event(Gitlab::Experimentation::EXPERIMENTS[:invite_email][:tracking_category], 'sent', property: 'experiment_group')
+ else
+ @invite_url_params = member.invite_to_unknown_user? ? { new_user_invite: 'control' } : {}
+
+ member_email_with_layout(
+ to: member.invite_email,
+ subject: subject_line
+ )
+
+ if member.invite_to_unknown_user?
+ Gitlab::Tracking.event(Gitlab::Experimentation::EXPERIMENTS[:invite_email][:tracking_category], 'sent', property: 'control_group')
+ end
+ end
end
def member_invite_accepted_email(member_source_type, member_id)
@@ -107,10 +130,15 @@ module Emails
@member_source_type.classify.constantize
end
- def member_email_with_layout(to:, subject:)
+ def member_email_with_layout(to:, subject:, template: nil, layout: 'mailer')
mail(to: to, subject: subject) do |format|
- format.html { render layout: 'mailer' }
- format.text { render layout: 'mailer' }
+ if template
+ format.html { render template, layout: layout }
+ format.text { render template, layout: layout }
+ else
+ format.html { render layout: layout }
+ format.text { render layout: layout }
+ end
end
end
end
diff --git a/app/mailers/emails/profile.rb b/app/mailers/emails/profile.rb
index b45755788b8..96cf3571968 100644
--- a/app/mailers/emails/profile.rb
+++ b/app/mailers/emails/profile.rb
@@ -72,6 +72,16 @@ module Emails
end
end
end
+
+ def disabled_two_factor_email(user)
+ return unless user
+
+ @user = user
+
+ Gitlab::I18n.with_locale(@user.preferred_language) do
+ mail(to: @user.notification_email, subject: subject(_("Two-factor authentication disabled")))
+ end
+ end
end
end