diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 01:45:44 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-19 01:45:44 +0000 |
commit | 85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch) | |
tree | 9160f299afd8c80c038f08e1545be119f5e3f1e1 /app/mailers/emails/members.rb | |
parent | 15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff) | |
download | gitlab-ce-85dc423f7090da0a52c73eb66faf22ddb20efff9.tar.gz |
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
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 |