diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-25 21:10:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-25 21:10:49 +0300 |
commit | 2b349d9a94f00320a82e24be96ee8aeda9135702 (patch) | |
tree | bf5531e0c78cf0f55c74e2e8651b5a2a7418f9a2 /app/mailers/emails/members.rb | |
parent | 11a29f1f026ecd0c466625782af00a14889a2f91 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/mailers/emails/members.rb')
-rw-r--r-- | app/mailers/emails/members.rb | 40 |
1 files changed, 34 insertions, 6 deletions
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 |