Commit 79fdfec5 authored by Stan Hu's avatar Stan Hu

Merge branch 'frozen-string-enable-app-mailers' into 'master'

Enable frozen in app/mailers/**/*.rb

See merge request gitlab-org/gitlab-ce!21147
parents 3a8e1fe9 8184ce7f
# frozen_string_literal: true
class AbuseReportMailer < BaseMailer class AbuseReportMailer < BaseMailer
def notify(abuse_report_id) def notify(abuse_report_id)
return unless deliverable? return unless deliverable?
......
# frozen_string_literal: true
class BaseMailer < ActionMailer::Base class BaseMailer < ActionMailer::Base
around_action :render_with_default_locale around_action :render_with_default_locale
......
# frozen_string_literal: true
class DeviseMailer < Devise::Mailer class DeviseMailer < Devise::Mailer
default from: "#{Gitlab.config.gitlab.email_display_name} <#{Gitlab.config.gitlab.email_from}>" default from: "#{Gitlab.config.gitlab.email_display_name} <#{Gitlab.config.gitlab.email_from}>"
default reply_to: Gitlab.config.gitlab.email_reply_to default reply_to: Gitlab.config.gitlab.email_reply_to
...@@ -9,8 +11,9 @@ class DeviseMailer < Devise::Mailer ...@@ -9,8 +11,9 @@ class DeviseMailer < Devise::Mailer
protected protected
def subject_for(key) def subject_for(key)
subject = super subject = [super]
subject << " | #{Gitlab.config.gitlab.email_subject_suffix}" if Gitlab.config.gitlab.email_subject_suffix.present? subject << Gitlab.config.gitlab.email_subject_suffix if Gitlab.config.gitlab.email_subject_suffix.present?
subject
subject.join(' | ')
end end
end end
# frozen_string_literal: true
class EmailRejectionMailer < BaseMailer class EmailRejectionMailer < BaseMailer
def rejection(reason, original_raw, can_retry = false) def rejection(reason, original_raw, can_retry = false)
@reason = reason @reason = reason
......
# frozen_string_literal: true
module Emails module Emails
module Issues module Issues
def new_issue_email(recipient_id, issue_id, reason = nil) def new_issue_email(recipient_id, issue_id, reason = nil)
......
# frozen_string_literal: true
module Emails module Emails
module Members module Members
extend ActiveSupport::Concern extend ActiveSupport::Concern
......
# frozen_string_literal: true
module Emails module Emails
module MergeRequests module MergeRequests
def new_merge_request_email(recipient_id, merge_request_id, reason = nil) def new_merge_request_email(recipient_id, merge_request_id, reason = nil)
......
# frozen_string_literal: true
module Emails module Emails
module Notes module Notes
def note_commit_email(recipient_id, note_id) def note_commit_email(recipient_id, note_id)
......
# frozen_string_literal: true
module Emails module Emails
module PagesDomains module PagesDomains
def pages_domain_enabled_email(domain, recipient) def pages_domain_enabled_email(domain, recipient)
......
# frozen_string_literal: true
module Emails module Emails
module Pipelines module Pipelines
def pipeline_success_email(pipeline, recipients) def pipeline_success_email(pipeline, recipients)
...@@ -39,10 +41,10 @@ module Emails ...@@ -39,10 +41,10 @@ module Emails
end end
def pipeline_subject(status) def pipeline_subject(status)
commit = @pipeline.short_sha commit = [@pipeline.short_sha]
commit << " in #{@merge_request.to_reference}" if @merge_request commit << "in #{@merge_request.to_reference}" if @merge_request
subject("Pipeline ##{@pipeline.id} has #{status} for #{@pipeline.ref}", commit) subject("Pipeline ##{@pipeline.id} has #{status} for #{@pipeline.ref}", commit.join(' '))
end end
end end
end end
# frozen_string_literal: true
module Emails module Emails
module Profile module Profile
def new_user_email(user_id, token = nil) def new_user_email(user_id, token = nil)
......
# frozen_string_literal: true
module Emails module Emails
module Projects module Projects
def project_was_moved_email(project_id, user_id, old_path_with_namespace) def project_was_moved_email(project_id, user_id, old_path_with_namespace)
......
# frozen_string_literal: true
class Notify < BaseMailer class Notify < BaseMailer
include ActionDispatch::Routing::PolymorphicRoutes include ActionDispatch::Routing::PolymorphicRoutes
include GitlabRoutingHelper include GitlabRoutingHelper
...@@ -92,12 +94,14 @@ class Notify < BaseMailer ...@@ -92,12 +94,14 @@ class Notify < BaseMailer
# >> subject('Lorem ipsum', 'Dolor sit amet') # >> subject('Lorem ipsum', 'Dolor sit amet')
# => "Lorem ipsum | Dolor sit amet" # => "Lorem ipsum | Dolor sit amet"
def subject(*extra) def subject(*extra)
subject = "" subject = []
subject << "#{@project.name} | " if @project
subject << "#{@group.name} | " if @group subject << @project.name if @project
subject << extra.join(' | ') if extra.present? subject << @group.name if @group
subject << " | #{Gitlab.config.gitlab.email_subject_suffix}" if Gitlab.config.gitlab.email_subject_suffix.present? subject.concat(extra) if extra.present?
subject subject << Gitlab.config.gitlab.email_subject_suffix if Gitlab.config.gitlab.email_subject_suffix.present?
subject.join(' | ')
end end
# Return a string suitable for inclusion in the 'Message-Id' mail header. # Return a string suitable for inclusion in the 'Message-Id' mail header.
......
# frozen_string_literal: true
class DeviseMailerPreview < ActionMailer::Preview class DeviseMailerPreview < ActionMailer::Preview
def confirmation_instructions_for_signup def confirmation_instructions_for_signup
DeviseMailer.confirmation_instructions(unsaved_user, 'faketoken', {}) DeviseMailer.confirmation_instructions(unsaved_user, 'faketoken', {})
......
# frozen_string_literal: true
class EmailRejectionMailerPreview < ActionMailer::Preview class EmailRejectionMailerPreview < ActionMailer::Preview
def rejection def rejection
EmailRejectionMailer.rejection("some rejection reason", "From: someone@example.com\nraw email here").message EmailRejectionMailer.rejection("some rejection reason", "From: someone@example.com\nraw email here").message
......
# frozen_string_literal: true
class NotifyPreview < ActionMailer::Preview class NotifyPreview < ActionMailer::Preview
def note_merge_request_email_for_individual_note def note_merge_request_email_for_individual_note
note_email(:note_merge_request_email) do note_email(:note_merge_request_email) do
......
# frozen_string_literal: true
class RepositoryCheckMailerPreview < ActionMailer::Preview class RepositoryCheckMailerPreview < ActionMailer::Preview
def notify def notify
RepositoryCheckMailer.notify(3).message RepositoryCheckMailer.notify(3).message
......
# frozen_string_literal: true
class RepositoryCheckMailer < BaseMailer class RepositoryCheckMailer < BaseMailer
def notify(failed_count) def notify(failed_count)
@message = @message =
......
---
title: Enable frozen in app/mailers/**/*.rb
merge_request: 21147
author: gfyoung
type: performance
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment