Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/mailers')
-rw-r--r--app/mailers/emails/issues.rb2
-rw-r--r--app/mailers/emails/notes.rb15
-rw-r--r--app/mailers/emails/profile.rb56
-rw-r--r--app/mailers/previews/notify_preview.rb5
4 files changed, 35 insertions, 43 deletions
diff --git a/app/mailers/emails/issues.rb b/app/mailers/emails/issues.rb
index 0328d262dc7..52a16475c07 100644
--- a/app/mailers/emails/issues.rb
+++ b/app/mailers/emails/issues.rb
@@ -190,7 +190,7 @@ module Emails
to: @recipient.notification_email_for(@project.group),
subject: subject("#{@issue.title} (##{@issue.iid})"),
'X-GitLab-NotificationReason' => reason,
- 'X-GitLab-ConfidentialIssue' => confidentiality
+ 'X-GitLab-ConfidentialIssue' => confidentiality.to_s
}
end
end
diff --git a/app/mailers/emails/notes.rb b/app/mailers/emails/notes.rb
index 1e254a32885..bdd63dfc62c 100644
--- a/app/mailers/emails/notes.rb
+++ b/app/mailers/emails/notes.rb
@@ -15,7 +15,14 @@ module Emails
@issue = @note.noteable
@target_url = project_issue_url(*note_target_url_options)
- mail_answer_note_thread(@issue, @note, note_thread_options(reason))
+ mail_answer_note_thread(
+ @issue,
+ @note,
+ note_thread_options(
+ reason,
+ confidentiality: @issue.confidential?
+ )
+ )
end
def note_merge_request_email(recipient_id, note_id, reason = nil)
@@ -62,13 +69,15 @@ module Emails
{ anchor: "note_#{@note.id}" }
end
- def note_thread_options(reason)
+ def note_thread_options(reason, confidentiality: nil)
{
from: sender(@note.author_id),
to: @recipient.notification_email_for(@project&.group || @group),
subject: subject("#{@note.noteable.title} (#{@note.noteable.reference_link_text})"),
'X-GitLab-NotificationReason' => reason
- }
+ }.tap do |options|
+ options['X-GitLab-ConfidentialIssue'] = confidentiality.to_s unless confidentiality.nil?
+ end
end
def setup_note_mail(note_id, recipient_id)
diff --git a/app/mailers/emails/profile.rb b/app/mailers/emails/profile.rb
index 54a4c4be6a8..a382ca15e46 100644
--- a/app/mailers/emails/profile.rb
+++ b/app/mailers/emails/profile.rb
@@ -65,9 +65,7 @@ module Emails
@target_url = profile_personal_access_tokens_url
@token_name = token_name
- Gitlab::I18n.with_locale(@user.preferred_language) do
- mail_with_locale(to: @user.notification_email_or_default, subject: subject(_("A new personal access token has been created")))
- end
+ mail_with_locale(to: @user.notification_email_or_default, subject: subject(_("A new personal access token has been created")))
end
def access_token_about_to_expire_email(user, token_names)
@@ -78,9 +76,7 @@ module Emails
@target_url = profile_personal_access_tokens_url
@days_to_expire = PersonalAccessToken::DAYS_TO_EXPIRE
- Gitlab::I18n.with_locale(@user.preferred_language) do
- mail_with_locale(to: @user.notification_email_or_default, subject: subject(_("Your personal access tokens will expire in %{days_to_expire} days or less") % { days_to_expire: @days_to_expire }))
- end
+ mail_with_locale(to: @user.notification_email_or_default, subject: subject(_("Your personal access tokens will expire in %{days_to_expire} days or less") % { days_to_expire: @days_to_expire }))
end
def access_token_expired_email(user, token_names = [])
@@ -90,9 +86,7 @@ module Emails
@token_names = token_names
@target_url = profile_personal_access_tokens_url
- Gitlab::I18n.with_locale(@user.preferred_language) do
- mail_with_locale(to: @user.notification_email_or_default, subject: subject(_("Your personal access tokens have expired")))
- end
+ email_with_layout(to: @user.notification_email_or_default, subject: subject(_("Your personal access tokens have expired")))
end
def access_token_revoked_email(user, token_name, source = nil)
@@ -103,9 +97,7 @@ module Emails
@target_url = profile_personal_access_tokens_url
@source = source
- Gitlab::I18n.with_locale(@user.preferred_language) do
- mail_with_locale(to: @user.notification_email_or_default, subject: subject(_("A personal access token has been revoked")))
- end
+ mail_with_locale(to: @user.notification_email_or_default, subject: subject(_("A personal access token has been revoked")))
end
def ssh_key_expired_email(user, fingerprints)
@@ -115,9 +107,7 @@ module Emails
@fingerprints = fingerprints
@target_url = profile_keys_url
- Gitlab::I18n.with_locale(@user.preferred_language) do
- mail_with_locale(to: @user.notification_email_or_default, subject: subject(_("Your SSH key has expired")))
- end
+ mail_with_locale(to: @user.notification_email_or_default, subject: subject(_("Your SSH key has expired")))
end
def ssh_key_expiring_soon_email(user, fingerprints)
@@ -127,9 +117,7 @@ module Emails
@fingerprints = fingerprints
@target_url = profile_keys_url
- Gitlab::I18n.with_locale(@user.preferred_language) do
- mail_with_locale(to: @user.notification_email_or_default, subject: subject(_("Your SSH key is expiring soon.")))
- end
+ mail_with_locale(to: @user.notification_email_or_default, subject: subject(_("Your SSH key is expiring soon.")))
end
def unknown_sign_in_email(user, ip, time)
@@ -138,11 +126,9 @@ module Emails
@time = time
@target_url = edit_profile_password_url
- Gitlab::I18n.with_locale(@user.preferred_language) do
- email_with_layout(
- to: @user.notification_email_or_default,
- subject: subject(_("%{host} sign-in from new location") % { host: Gitlab.config.gitlab.host }))
- end
+ email_with_layout(
+ to: @user.notification_email_or_default,
+ subject: subject(_("%{host} sign-in from new location") % { host: Gitlab.config.gitlab.host }))
end
def two_factor_otp_attempt_failed_email(user, ip, time = Time.current)
@@ -150,11 +136,9 @@ module Emails
@ip = ip
@time = time
- Gitlab::I18n.with_locale(@user.preferred_language) do
- email_with_layout(
- to: @user.notification_email_or_default,
- subject: subject(_("Attempted sign in to %{host} using an incorrect verification code") % { host: Gitlab.config.gitlab.host }))
- end
+ email_with_layout(
+ to: @user.notification_email_or_default,
+ subject: subject(_("Attempted sign in to %{host} using an incorrect verification code") % { host: Gitlab.config.gitlab.host }))
end
def disabled_two_factor_email(user)
@@ -162,9 +146,7 @@ module Emails
@user = user
- Gitlab::I18n.with_locale(@user.preferred_language) do
- mail_with_locale(to: @user.notification_email_or_default, subject: subject(_("Two-factor authentication disabled")))
- end
+ mail_with_locale(to: @user.notification_email_or_default, subject: subject(_("Two-factor authentication disabled")))
end
def new_email_address_added_email(user, email)
@@ -173,9 +155,7 @@ module Emails
@user = user
@email = email
- Gitlab::I18n.with_locale(@user.preferred_language) do
- mail_with_locale(to: @user.notification_email_or_default, subject: subject(_("New email address added")))
- end
+ mail_with_locale(to: @user.notification_email_or_default, subject: subject(_("New email address added")))
end
def new_achievement_email(user, achievement)
@@ -184,11 +164,9 @@ module Emails
@user = user
@achievement = achievement
- Gitlab::I18n.with_locale(@user.preferred_language) do
- email_with_layout(
- to: @user.notification_email_or_default,
- subject: subject(s_("Achievements|%{namespace_full_path} awarded you the %{achievement_name} achievement") % { namespace_full_path: @achievement.namespace.full_path, achievement_name: @achievement.name }))
- end
+ email_with_layout(
+ to: @user.notification_email_or_default,
+ subject: subject(s_("Achievements|%{namespace_full_path} awarded you the %{achievement_name} achievement") % { namespace_full_path: @achievement.namespace.full_path, achievement_name: @achievement.name }))
end
end
end
diff --git a/app/mailers/previews/notify_preview.rb b/app/mailers/previews/notify_preview.rb
index d91f69cdd4b..576dbdd8b52 100644
--- a/app/mailers/previews/notify_preview.rb
+++ b/app/mailers/previews/notify_preview.rb
@@ -64,6 +64,11 @@ class NotifyPreview < ActionMailer::Preview
Notify.access_token_created_email(user, 'token_name').message
end
+ def access_token_expired_email
+ token_names = []
+ Notify.access_token_expired_email(user, token_names).message
+ end
+
def access_token_revoked_email
Notify.access_token_revoked_email(user, 'token_name').message
end