diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-20 15:08:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-20 15:08:54 +0300 |
commit | be2142bf5e03af8ba9bb96e4bf0b4781184ae01b (patch) | |
tree | b40aab281b29a56bd398757564d271c8b3aa8662 /app/mailers/emails/members.rb | |
parent | bc12365ae0254332f97299138f019bea3ff12351 (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 | 51 |
1 files changed, 16 insertions, 35 deletions
diff --git a/app/mailers/emails/members.rb b/app/mailers/emails/members.rb index 57e4c7df440..0b5a8dfdc24 100644 --- a/app/mailers/emails/members.rb +++ b/app/mailers/emails/members.rb @@ -51,34 +51,20 @@ module Emails return unless member_exists? - 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') + subject_line = + if member.created_by + subject(s_("MemberInviteEmail|%{member_name} invited you to join GitLab") % { member_name: member.created_by.name }) + 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 - end - if member.invite_to_unknown_user? && Gitlab::Experimentation.enabled?(:invitation_reminders) + member_email_with_layout( + to: member.invite_email, + subject: subject_line, + layout: 'unknown_user_mailer' + ) + + if Gitlab::Experimentation.enabled?(:invitation_reminders) Gitlab::Tracking.event( Gitlab::Experimentation.experiment(:invitation_reminders).tracking_category, 'sent', @@ -105,7 +91,7 @@ module Emails subject_line = subjects[reminder_index] % { inviter: member.created_by.name } member_email_with_layout( - layout: 'experiment_mailer', + layout: 'unknown_user_mailer', to: member.invite_email, subject: subject(subject_line) ) @@ -162,15 +148,10 @@ module Emails @member_source_type.classify.constantize end - def member_email_with_layout(to:, subject:, template: nil, layout: 'mailer') + def member_email_with_layout(to:, subject:, layout: 'mailer') mail(to: to, subject: subject) do |format| - 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 + format.html { render layout: layout } + format.text { render layout: layout } end end end |