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

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
def notify(abuse_report_id)
return unless deliverable?
......
# frozen_string_literal: true
class BaseMailer < ActionMailer::Base
around_action :render_with_default_locale
......
# frozen_string_literal: true
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
......@@ -9,8 +11,9 @@ class DeviseMailer < Devise::Mailer
protected
def subject_for(key)
subject = super
subject << " | #{Gitlab.config.gitlab.email_subject_suffix}" if Gitlab.config.gitlab.email_subject_suffix.present?
subject
subject = [super]
subject << Gitlab.config.gitlab.email_subject_suffix if Gitlab.config.gitlab.email_subject_suffix.present?
subject.join(' | ')
end
end
# frozen_string_literal: true
class EmailRejectionMailer < BaseMailer
def rejection(reason, original_raw, can_retry = false)
@reason = reason
......
# frozen_string_literal: true
module Emails
module Issues
def new_issue_email(recipient_id, issue_id, reason = nil)
......
# frozen_string_literal: true
module Emails
module Members
extend ActiveSupport::Concern
......
# frozen_string_literal: true
module Emails
module MergeRequests
def new_merge_request_email(recipient_id, merge_request_id, reason = nil)
......
# frozen_string_literal: true
module Emails
module Notes
def note_commit_email(recipient_id, note_id)
......
# frozen_string_literal: true
module Emails
module PagesDomains
def pages_domain_enabled_email(domain, recipient)
......
# frozen_string_literal: true
module Emails
module Pipelines
def pipeline_success_email(pipeline, recipients)
......@@ -39,10 +41,10 @@ def add_pipeline_headers
end
def pipeline_subject(status)
commit = @pipeline.short_sha
commit << " in #{@merge_request.to_reference}" if @merge_request
commit = [@pipeline.short_sha]
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
# frozen_string_literal: true
module Emails
module Profile
def new_user_email(user_id, token = nil)
......
# frozen_string_literal: true
module Emails
module Projects
def project_was_moved_email(project_id, user_id, old_path_with_namespace)
......
# frozen_string_literal: true
class Notify < BaseMailer
include ActionDispatch::Routing::PolymorphicRoutes
include GitlabRoutingHelper
......@@ -92,12 +94,14 @@ def recipient(recipient_id)
# >> subject('Lorem ipsum', 'Dolor sit amet')
# => "Lorem ipsum | Dolor sit amet"
def subject(*extra)
subject = ""
subject << "#{@project.name} | " if @project
subject << "#{@group.name} | " if @group
subject << extra.join(' | ') if extra.present?
subject << " | #{Gitlab.config.gitlab.email_subject_suffix}" if Gitlab.config.gitlab.email_subject_suffix.present?
subject
subject = []
subject << @project.name if @project
subject << @group.name if @group
subject.concat(extra) if extra.present?
subject << Gitlab.config.gitlab.email_subject_suffix if Gitlab.config.gitlab.email_subject_suffix.present?
subject.join(' | ')
end
# Return a string suitable for inclusion in the 'Message-Id' mail header.
......
# frozen_string_literal: true
class DeviseMailerPreview < ActionMailer::Preview
def confirmation_instructions_for_signup
DeviseMailer.confirmation_instructions(unsaved_user, 'faketoken', {})
......
# frozen_string_literal: true
class EmailRejectionMailerPreview < ActionMailer::Preview
def rejection
EmailRejectionMailer.rejection("some rejection reason", "From: someone@example.com\nraw email here").message
......
# frozen_string_literal: true
class NotifyPreview < ActionMailer::Preview
def note_merge_request_email_for_individual_note
note_email(:note_merge_request_email) do
......
# frozen_string_literal: true
class RepositoryCheckMailerPreview < ActionMailer::Preview
def notify
RepositoryCheckMailer.notify(3).message
......
# frozen_string_literal: true
class RepositoryCheckMailer < BaseMailer
def notify(failed_count)
@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