diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-25 12:10:52 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-25 12:10:52 +0300 |
commit | 326b4d3216d107b40142ee847c06f2c41a1ef220 (patch) | |
tree | f5190e9c606a92c0ed4ce606a52b49366055065e /app/mailers/emails/members.rb | |
parent | 92e4789eb069d5fe43025601c6b7839fddda3ad1 (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 | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/app/mailers/emails/members.rb b/app/mailers/emails/members.rb index fe2d2891547..53b38cc5972 100644 --- a/app/mailers/emails/members.rb +++ b/app/mailers/emails/members.rb @@ -57,7 +57,7 @@ module Emails Gitlab::Tracking.event(self.class.name, 'invite_email_sent', label: 'invite_email', property: member_id.to_s) - mail(to: member.invite_email, subject: invite_email_subject, **invite_email_headers) do |format| + mail(to: member.invite_email, subject: invite_email_subject, **invite_email_headers.merge(additional_invite_settings)) do |format| format.html { render layout: 'unknown_user_mailer' } format.text { render layout: 'unknown_user_mailer' } end @@ -147,7 +147,17 @@ module Emails def invite_email_subject if member.created_by - subject(s_("MemberInviteEmail|%{member_name} invited you to join GitLab") % { member_name: member.created_by.name }) + experiment(:invite_email_from, actor: member) do |experiment_instance| + experiment_instance.use do + subject(s_("MemberInviteEmail|%{member_name} invited you to join GitLab") % { member_name: member.created_by.name }) + end + + experiment_instance.candidate do + subject(s_("MemberInviteEmail|I've invited you to join me in GitLab")) + end + + experiment_instance.run + end else subject(s_("MemberInviteEmail|Invitation to join the %{project_or_group} %{project_or_group_name}") % { project_or_group: member_source.human_name, project_or_group_name: member_source.model_name.singular }) end @@ -164,6 +174,21 @@ module Emails end end + def additional_invite_settings + return {} unless member.created_by + + experiment(:invite_email_from, actor: member) do |experiment_instance| + experiment_instance.use { {} } + experiment_instance.candidate do + { + from: "#{member.created_by.name} <#{member.created_by.email}>" + } + end + + experiment_instance.run + end + end + def member_exists? Gitlab::AppLogger.info("Tried to send an email invitation for a deleted group. Member id: #{@member_id}") if member.blank? member.present? |