summaryrefslogtreecommitdiff
path: root/app/mailers/emails/members.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/mailers/emails/members.rb')
-rw-r--r--app/mailers/emails/members.rb35
1 files changed, 23 insertions, 12 deletions
diff --git a/app/mailers/emails/members.rb b/app/mailers/emails/members.rb
index 674a9bfc4eb..d1870065845 100644
--- a/app/mailers/emails/members.rb
+++ b/app/mailers/emails/members.rb
@@ -53,18 +53,10 @@ module Emails
return unless member_exists?
- 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
-
- member_email_with_layout(
- to: member.invite_email,
- subject: subject_line,
- layout: 'unknown_user_mailer'
- )
+ mail(to: member.invite_email, subject: invite_email_subject, **invite_email_headers) do |format|
+ format.html { render layout: 'unknown_user_mailer' }
+ format.text { render layout: 'unknown_user_mailer' }
+ end
end
def member_invited_reminder_email(member_source_type, member_id, token, reminder_index)
@@ -149,6 +141,25 @@ module Emails
private
+ def invite_email_subject
+ 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
+
+ def invite_email_headers
+ if Gitlab.dev_env_or_com?
+ {
+ 'X-Mailgun-Tag' => 'invite_email',
+ 'X-Mailgun-Variables' => { 'invite_token' => @token }.to_json
+ }
+ else
+ {}
+ 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?