summaryrefslogtreecommitdiff
path: root/app/mailers
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2019-02-28 19:57:34 +0100
committerToon Claes <toon@gitlab.com>2019-02-28 19:57:34 +0100
commit62d7990b9bb30cf33ed87017c5c633d1cccc75c2 (patch)
treec3e1b69c58a412ba1c6f50a0337a23d9f9d6e1a4 /app/mailers
parentf6453eca992a9c142268e78ac782cef98110d183 (diff)
downloadgitlab-ce-tc-standard-gem.tar.gz
Ran standardrb --fix on the whole codebasetc-standard-gem
Inspired by https://twitter.com/searls/status/1101137953743613952 I decided to try https://github.com/testdouble/standard on our codebase. It's opinionated, but at least it's a _standard_.
Diffstat (limited to 'app/mailers')
-rw-r--r--app/mailers/abuse_report_mailer.rb6
-rw-r--r--app/mailers/devise_mailer.rb4
-rw-r--r--app/mailers/email_rejection_mailer.rb12
-rw-r--r--app/mailers/emails/auto_devops.rb4
-rw-r--r--app/mailers/emails/issues.rb16
-rw-r--r--app/mailers/emails/members.rb4
-rw-r--r--app/mailers/emails/merge_requests.rb10
-rw-r--r--app/mailers/emails/notes.rb2
-rw-r--r--app/mailers/emails/pipelines.rb16
-rw-r--r--app/mailers/emails/projects.rb8
-rw-r--r--app/mailers/emails/remote_mirrors.rb2
-rw-r--r--app/mailers/notify.rb41
-rw-r--r--app/mailers/previews/devise_mailer_preview.rb12
-rw-r--r--app/mailers/previews/notify_preview.rb30
-rw-r--r--app/mailers/repository_check_mailer.rb2
15 files changed, 84 insertions, 85 deletions
diff --git a/app/mailers/abuse_report_mailer.rb b/app/mailers/abuse_report_mailer.rb
index e0aa66e6de3..41aa27ed8de 100644
--- a/app/mailers/abuse_report_mailer.rb
+++ b/app/mailers/abuse_report_mailer.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
class AbuseReportMailer < BaseMailer
- layout 'empty_mailer'
+ layout "empty_mailer"
helper EmailsHelper
@@ -11,8 +11,8 @@ class AbuseReportMailer < BaseMailer
@abuse_report = AbuseReport.find(abuse_report_id)
mail(
- to: Gitlab::CurrentSettings.admin_notification_email,
- subject: "#{@abuse_report.user.name} (#{@abuse_report.user.username}) was reported for abuse"
+ to: Gitlab::CurrentSettings.admin_notification_email,
+ subject: "#{@abuse_report.user.name} (#{@abuse_report.user.username}) was reported for abuse"
)
end
diff --git a/app/mailers/devise_mailer.rb b/app/mailers/devise_mailer.rb
index 7aa75ee30e6..f018364a1a9 100644
--- a/app/mailers/devise_mailer.rb
+++ b/app/mailers/devise_mailer.rb
@@ -4,7 +4,7 @@ class DeviseMailer < Devise::Mailer
default from: "#{Gitlab.config.gitlab.email_display_name} <#{Gitlab.config.gitlab.email_from}>"
default reply_to: Gitlab.config.gitlab.email_reply_to
- layout 'mailer/devise'
+ layout "mailer/devise"
helper EmailsHelper
@@ -14,6 +14,6 @@ class DeviseMailer < Devise::Mailer
subject = [super]
subject << Gitlab.config.gitlab.email_subject_suffix if Gitlab.config.gitlab.email_subject_suffix.present?
- subject.join(' | ')
+ subject.join(" | ")
end
end
diff --git a/app/mailers/email_rejection_mailer.rb b/app/mailers/email_rejection_mailer.rb
index d743533b1bc..781517c360f 100644
--- a/app/mailers/email_rejection_mailer.rb
+++ b/app/mailers/email_rejection_mailer.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
class EmailRejectionMailer < BaseMailer
- layout 'empty_mailer'
+ layout "empty_mailer"
helper EmailsHelper
@@ -13,14 +13,14 @@ class EmailRejectionMailer < BaseMailer
headers = {
to: @original_message.from,
- subject: "[Rejected] #{@original_message.subject}"
+ subject: "[Rejected] #{@original_message.subject}",
}
- headers['Message-ID'] = "<#{SecureRandom.hex}@#{Gitlab.config.gitlab.host}>"
- headers['In-Reply-To'] = @original_message.message_id
- headers['References'] = @original_message.message_id
+ headers["Message-ID"] = "<#{SecureRandom.hex}@#{Gitlab.config.gitlab.host}>"
+ headers["In-Reply-To"] = @original_message.message_id
+ headers["References"] = @original_message.message_id
- headers['Reply-To'] = @original_message.to.first if can_retry
+ headers["Reply-To"] = @original_message.to.first if can_retry
mail(headers)
end
diff --git a/app/mailers/emails/auto_devops.rb b/app/mailers/emails/auto_devops.rb
index 9705a3052d4..7cd33cd9dcc 100644
--- a/app/mailers/emails/auto_devops.rb
+++ b/app/mailers/emails/auto_devops.rb
@@ -10,8 +10,8 @@ module Emails
mail(to: recipient,
subject: auto_devops_disabled_subject(@project.name)) do |format|
- format.html { render layout: 'mailer' }
- format.text { render layout: 'mailer' }
+ format.html { render layout: "mailer" }
+ format.text { render layout: "mailer" }
end
end
diff --git a/app/mailers/emails/issues.rb b/app/mailers/emails/issues.rb
index 654ae211310..0f91449ba50 100644
--- a/app/mailers/emails/issues.rb
+++ b/app/mailers/emails/issues.rb
@@ -57,7 +57,7 @@ module Emails
@milestone = milestone
@milestone_url = milestone_url(@milestone)
mail_answer_thread(@issue, issue_thread_options(updated_by_user_id, recipient_id, reason).merge({
- template_name: 'changed_milestone_email'
+ template_name: "changed_milestone_email",
}))
end
@@ -82,9 +82,9 @@ module Emails
@project = Project.find(project_id)
@results = results
- mail(to: @user.notification_email, subject: subject('Imported issues')) do |format|
- format.html { render layout: 'mailer' }
- format.text { render layout: 'mailer' }
+ mail(to: @user.notification_email, subject: subject("Imported issues")) do |format|
+ format.html { render layout: "mailer" }
+ format.text { render layout: "mailer" }
end
end
@@ -100,10 +100,10 @@ module Emails
def issue_thread_options(sender_id, recipient_id, reason)
{
- from: sender(sender_id),
- to: recipient(recipient_id),
- subject: subject("#{@issue.title} (##{@issue.iid})"),
- 'X-GitLab-NotificationReason' => reason
+ :from => sender(sender_id),
+ :to => recipient(recipient_id),
+ :subject => subject("#{@issue.title} (##{@issue.iid})"),
+ "X-GitLab-NotificationReason" => reason,
}
end
end
diff --git a/app/mailers/emails/members.rb b/app/mailers/emails/members.rb
index 91dfdf58982..e77a9b01961 100644
--- a/app/mailers/emails/members.rb
+++ b/app/mailers/emails/members.rb
@@ -49,7 +49,7 @@ module Emails
return unless member.created_by
mail(to: member.created_by.notification_email,
- subject: subject('Invitation accepted'))
+ subject: subject("Invitation accepted"))
end
def member_invite_declined_email(member_source_type, source_id, invite_email, created_by_id)
@@ -61,7 +61,7 @@ module Emails
inviter = User.find(created_by_id)
mail(to: inviter.notification_email,
- subject: subject('Invitation declined'))
+ subject: subject("Invitation declined"))
end
def member
diff --git a/app/mailers/emails/merge_requests.rb b/app/mailers/emails/merge_requests.rb
index 9ba8f92fcbf..e7568c8d319 100644
--- a/app/mailers/emails/merge_requests.rb
+++ b/app/mailers/emails/merge_requests.rb
@@ -52,7 +52,7 @@ module Emails
@milestone = milestone
@milestone_url = milestone_url(@milestone)
mail_answer_thread(@merge_request, merge_request_thread_options(updated_by_user_id, recipient_id, reason).merge({
- template_name: 'changed_milestone_email'
+ template_name: "changed_milestone_email",
}))
end
@@ -107,10 +107,10 @@ module Emails
def merge_request_thread_options(sender_id, recipient_id, reason = nil)
{
- from: sender(sender_id),
- to: recipient(recipient_id),
- subject: subject("#{@merge_request.title} (#{@merge_request.to_reference})"),
- 'X-GitLab-NotificationReason' => reason
+ :from => sender(sender_id),
+ :to => recipient(recipient_id),
+ :subject => subject("#{@merge_request.title} (#{@merge_request.to_reference})"),
+ "X-GitLab-NotificationReason" => reason,
}
end
end
diff --git a/app/mailers/emails/notes.rb b/app/mailers/emails/notes.rb
index 1b3c1f9a8a9..342fa2755aa 100644
--- a/app/mailers/emails/notes.rb
+++ b/app/mailers/emails/notes.rb
@@ -52,7 +52,7 @@ module Emails
{
from: sender(@note.author_id),
to: recipient(recipient_id),
- subject: subject("#{@note.noteable.title} (#{@note.noteable.reference_link_text})")
+ subject: subject("#{@note.noteable.title} (#{@note.noteable.reference_link_text})"),
}
end
diff --git a/app/mailers/emails/pipelines.rb b/app/mailers/emails/pipelines.rb
index 31e183640ad..9f0315d9bd4 100644
--- a/app/mailers/emails/pipelines.rb
+++ b/app/mailers/emails/pipelines.rb
@@ -3,11 +3,11 @@
module Emails
module Pipelines
def pipeline_success_email(pipeline, recipients)
- pipeline_mail(pipeline, recipients, 'succeeded')
+ pipeline_mail(pipeline, recipients, "succeeded")
end
def pipeline_failed_email(pipeline, recipients)
- pipeline_mail(pipeline, recipients, 'failed')
+ pipeline_mail(pipeline, recipients, "failed")
end
private
@@ -24,8 +24,8 @@ module Emails
mail(bcc: recipients,
subject: pipeline_subject(status),
skip_premailer: true) do |format|
- format.html { render layout: 'mailer' }
- format.text { render layout: 'mailer' }
+ format.html { render layout: "mailer" }
+ format.text { render layout: "mailer" }
end
end
@@ -35,16 +35,16 @@ module Emails
end
def add_pipeline_headers
- headers['X-GitLab-Pipeline-Id'] = @pipeline.id
- headers['X-GitLab-Pipeline-Ref'] = @pipeline.ref
- headers['X-GitLab-Pipeline-Status'] = @pipeline.status
+ headers["X-GitLab-Pipeline-Id"] = @pipeline.id
+ headers["X-GitLab-Pipeline-Ref"] = @pipeline.ref
+ headers["X-GitLab-Pipeline-Status"] = @pipeline.status
end
def pipeline_subject(status)
commit = [@pipeline.short_sha]
commit << "in #{@merge_request.to_reference}" if @merge_request
- subject("Pipeline ##{@pipeline.id} has #{status} for #{@pipeline.ref}", commit.join(' '))
+ subject("Pipeline ##{@pipeline.id} has #{status} for #{@pipeline.ref}", commit.join(" "))
end
end
end
diff --git a/app/mailers/emails/projects.rb b/app/mailers/emails/projects.rb
index 2500622caa7..15f58f810c0 100644
--- a/app/mailers/emails/projects.rb
+++ b/app/mailers/emails/projects.rb
@@ -49,11 +49,11 @@ module Emails
@diff_notes_disabled = true
add_project_headers
- headers['X-GitLab-Author'] = @message.author_username
+ headers["X-GitLab-Author"] = @message.author_username
- mail(from: sender(@message.author_id, @message.send_from_committer_email?),
- reply_to: @message.reply_to,
- subject: @message.subject)
+ mail(from: sender(@message.author_id, @message.send_from_committer_email?),
+ reply_to: @message.reply_to,
+ subject: @message.subject)
end
end
end
diff --git a/app/mailers/emails/remote_mirrors.rb b/app/mailers/emails/remote_mirrors.rb
index 2018eb7260b..4396ea82c13 100644
--- a/app/mailers/emails/remote_mirrors.rb
+++ b/app/mailers/emails/remote_mirrors.rb
@@ -6,7 +6,7 @@ module Emails
@remote_mirror = RemoteMirrorFinder.new(id: remote_mirror_id).execute
@project = @remote_mirror.project
- mail(to: recipient(recipient_id), subject: subject('Remote mirror update failed'))
+ mail(to: recipient(recipient_id), subject: subject("Remote mirror update failed"))
end
end
end
diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb
index efa1233b434..7f3098e09a6 100644
--- a/app/mailers/notify.rb
+++ b/app/mailers/notify.rb
@@ -29,8 +29,7 @@ class Notify < BaseMailer
mail(to: recipient_email,
subject: subject,
body: body.html_safe,
- content_type: 'text/html'
- )
+ content_type: "text/html")
end
# Splits "gitlab.corp.company.com" up into "gitlab.corp.company.com",
@@ -105,7 +104,7 @@ class Notify < BaseMailer
subject.concat(extra) if extra.present?
subject << Gitlab.config.gitlab.email_subject_suffix if Gitlab.config.gitlab.email_subject_suffix.present?
- subject.join(' | ')
+ subject.join(" | ")
end
# Return a string suitable for inclusion in the 'Message-Id' mail header.
@@ -122,18 +121,18 @@ class Notify < BaseMailer
headers["X-GitLab-#{model.class.name}-ID"] = model.id
headers["X-GitLab-#{model.class.name}-IID"] = model.iid if model.respond_to?(:iid)
- headers['X-GitLab-Reply-Key'] = reply_key
+ headers["X-GitLab-Reply-Key"] = reply_key
- @reason = headers['X-GitLab-NotificationReason']
+ @reason = headers["X-GitLab-NotificationReason"]
if Gitlab::IncomingEmail.enabled? && @sent_notification
- headers['Reply-To'] = Mail::Address.new(Gitlab::IncomingEmail.reply_address(reply_key)).tap do |address|
+ headers["Reply-To"] = Mail::Address.new(Gitlab::IncomingEmail.reply_address(reply_key)).tap do |address|
address.display_name = reply_display_name(model)
end
fallback_reply_message_id = "<reply-#{reply_key}@#{Gitlab.config.gitlab.host}>"
- headers['References'] ||= []
- headers['References'].unshift(fallback_reply_message_id)
+ headers["References"] ||= []
+ headers["References"].unshift(fallback_reply_message_id)
@reply_by_email = true
end
@@ -151,7 +150,7 @@ class Notify < BaseMailer
#
# See: mail_answer_thread
def mail_new_thread(model, headers = {})
- headers['Message-ID'] = message_id(model)
+ headers["Message-ID"] = message_id(model)
mail_thread(model, headers)
end
@@ -165,9 +164,9 @@ class Notify < BaseMailer
# * have a 'In-Reply-To' or 'References' header that references the original 'Message-ID'
#
def mail_answer_thread(model, headers = {})
- headers['Message-ID'] = "<#{SecureRandom.hex}@#{Gitlab.config.gitlab.host}>"
- headers['In-Reply-To'] = message_id(model)
- headers['References'] = [message_id(model)]
+ headers["Message-ID"] = "<#{SecureRandom.hex}@#{Gitlab.config.gitlab.host}>"
+ headers["In-Reply-To"] = message_id(model)
+ headers["References"] = [message_id(model)]
headers[:subject] = "Re: #{headers[:subject]}" if headers[:subject]
@@ -175,11 +174,11 @@ class Notify < BaseMailer
end
def mail_answer_note_thread(model, note, headers = {})
- headers['Message-ID'] = message_id(note)
- headers['In-Reply-To'] = message_id(note.references.last)
- headers['References'] = note.references.map { |ref| message_id(ref) }
+ headers["Message-ID"] = message_id(note)
+ headers["In-Reply-To"] = message_id(note.references.last)
+ headers["References"] = note.references.map { |ref| message_id(ref) }
- headers['X-GitLab-Discussion-ID'] = note.discussion.id if note.part_of_discussion?
+ headers["X-GitLab-Discussion-ID"] = note.discussion.id if note.part_of_discussion?
headers[:subject] = "Re: #{headers[:subject]}" if headers[:subject]
@@ -193,10 +192,10 @@ class Notify < BaseMailer
def add_project_headers
return unless @project
- headers['X-GitLab-Project'] = @project.name
- headers['X-GitLab-Project-Id'] = @project.id
- headers['X-GitLab-Project-Path'] = @project.full_path
- headers['List-Id'] = "#{@project.full_path} <#{create_list_id_string(@project)}>"
+ headers["X-GitLab-Project"] = @project.name
+ headers["X-GitLab-Project-Id"] = @project.id
+ headers["X-GitLab-Project-Path"] = @project.full_path
+ headers["List-Id"] = "#{@project.full_path} <#{create_list_id_string(@project)}>"
end
def add_unsubscription_headers_and_links
@@ -207,7 +206,7 @@ class Notify < BaseMailer
list_unsubscribe_methods << "mailto:#{Gitlab::IncomingEmail.unsubscribe_address(reply_key)}"
end
- headers['List-Unsubscribe'] = list_unsubscribe_methods.map { |e| "<#{e}>" }.join(',')
+ headers["List-Unsubscribe"] = list_unsubscribe_methods.map { |e| "<#{e}>" }.join(",")
@unsubscribe_url = unsubscribe_sent_notification_url(@sent_notification)
end
end
diff --git a/app/mailers/previews/devise_mailer_preview.rb b/app/mailers/previews/devise_mailer_preview.rb
index 3b9ef0d3ac0..963d13c946d 100644
--- a/app/mailers/previews/devise_mailer_preview.rb
+++ b/app/mailers/previews/devise_mailer_preview.rb
@@ -2,22 +2,22 @@
class DeviseMailerPreview < ActionMailer::Preview
def confirmation_instructions_for_signup
- DeviseMailer.confirmation_instructions(unsaved_user, 'faketoken', {})
+ DeviseMailer.confirmation_instructions(unsaved_user, "faketoken", {})
end
def confirmation_instructions_for_new_email
user = User.last
- user.unconfirmed_email = 'unconfirmed@example.com'
+ user.unconfirmed_email = "unconfirmed@example.com"
- DeviseMailer.confirmation_instructions(user, 'faketoken', {})
+ DeviseMailer.confirmation_instructions(user, "faketoken", {})
end
def reset_password_instructions
- DeviseMailer.reset_password_instructions(unsaved_user, 'faketoken', {})
+ DeviseMailer.reset_password_instructions(unsaved_user, "faketoken", {})
end
def unlock_instructions
- DeviseMailer.unlock_instructions(unsaved_user, 'faketoken', {})
+ DeviseMailer.unlock_instructions(unsaved_user, "faketoken", {})
end
def password_change
@@ -27,6 +27,6 @@ class DeviseMailerPreview < ActionMailer::Preview
private
def unsaved_user
- User.new(name: 'Jane Doe', email: 'jdoe@example.com')
+ User.new(name: "Jane Doe", email: "jdoe@example.com")
end
end
diff --git a/app/mailers/previews/notify_preview.rb b/app/mailers/previews/notify_preview.rb
index 80e0a17c312..8d7a3bc8d81 100644
--- a/app/mailers/previews/notify_preview.rb
+++ b/app/mailers/previews/notify_preview.rb
@@ -13,7 +13,7 @@ class NotifyPreview < ActionMailer::Preview
- An explanation for why the user is receiving this notification
MD
- create_note(noteable_type: 'merge_request', noteable_id: merge_request.id, note: note)
+ create_note(noteable_type: "merge_request", noteable_id: merge_request.id, note: note)
end
end
@@ -30,7 +30,7 @@ class NotifyPreview < ActionMailer::Preview
- An explanation for why the user is receiving this notification
MD
- create_note(noteable_type: 'merge_request', noteable_id: merge_request.id, type: 'DiscussionNote', note: note)
+ create_note(noteable_type: "merge_request", noteable_id: merge_request.id, type: "DiscussionNote", note: note)
end
end
@@ -56,7 +56,7 @@ class NotifyPreview < ActionMailer::Preview
diff_refs: merge_request.diff_refs
)
- create_note(noteable_type: 'merge_request', noteable_id: merge_request.id, type: 'DiffNote', position: position, note: note)
+ create_note(noteable_type: "merge_request", noteable_id: merge_request.id, type: "DiffNote", position: position, note: note)
end
end
@@ -65,7 +65,7 @@ class NotifyPreview < ActionMailer::Preview
end
def issue_status_changed_email
- Notify.issue_status_changed_email(user.id, issue.id, 'closed', user.id).message
+ Notify.issue_status_changed_email(user.id, issue.id, "closed", user.id).message
end
def removed_milestone_issue_email
@@ -77,7 +77,7 @@ class NotifyPreview < ActionMailer::Preview
end
def import_issues_csv_email
- Notify.import_issues_csv_email(user, project, { success: 3, errors: [5, 6, 7], valid_file: true })
+ Notify.import_issues_csv_email(user, project, {success: 3, errors: [5, 6, 7], valid_file: true})
end
def closed_merge_request_email
@@ -85,7 +85,7 @@ class NotifyPreview < ActionMailer::Preview
end
def merge_request_status_email
- Notify.merge_request_status_email(user.id, merge_request.id, 'closed', user.id).message
+ Notify.merge_request_status_email(user.id, merge_request.id, "closed", user.id).message
end
def merged_merge_request_email
@@ -101,37 +101,37 @@ class NotifyPreview < ActionMailer::Preview
end
def member_access_denied_email
- Notify.member_access_denied_email('project', project.id, user.id).message
+ Notify.member_access_denied_email("project", project.id, user.id).message
end
def member_access_granted_email
- Notify.member_access_granted_email('project', user.id).message
+ Notify.member_access_granted_email("project", user.id).message
end
def member_access_requested_email
- Notify.member_access_requested_email('group', user.id, 'some@example.com').message
+ Notify.member_access_requested_email("group", user.id, "some@example.com").message
end
def member_invite_accepted_email
- Notify.member_invite_accepted_email('project', user.id).message
+ Notify.member_invite_accepted_email("project", user.id).message
end
def member_invite_declined_email
Notify.member_invite_declined_email(
- 'project',
+ "project",
project.id,
- 'invite@example.com',
+ "invite@example.com",
user.id
).message
end
def member_invited_email
- Notify.member_invited_email('project', user.id, '1234').message
+ Notify.member_invited_email("project", user.id, "1234").message
end
def pages_domain_enabled_email
cleanup do
- pages_domain = PagesDomain.new(domain: 'my.example.com', project: project, verified_at: Time.now, enabled_until: 1.week.from_now)
+ pages_domain = PagesDomain.new(domain: "my.example.com", project: project, verified_at: Time.now, enabled_until: 1.week.from_now)
Notify.pages_domain_enabled_email(pages_domain, user).message
end
@@ -156,7 +156,7 @@ class NotifyPreview < ActionMailer::Preview
private
def project
- @project ||= Project.find_by_full_path('gitlab-org/gitlab-test')
+ @project ||= Project.find_by_full_path("gitlab-org/gitlab-test")
end
def issue
diff --git a/app/mailers/repository_check_mailer.rb b/app/mailers/repository_check_mailer.rb
index a24d3476d0e..448b52af777 100644
--- a/app/mailers/repository_check_mailer.rb
+++ b/app/mailers/repository_check_mailer.rb
@@ -2,7 +2,7 @@
class RepositoryCheckMailer < BaseMailer
# rubocop: disable CodeReuse/ActiveRecord
- layout 'empty_mailer'
+ layout "empty_mailer"
helper EmailsHelper