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

This commit is contained in:
gfyoung 2018-08-15 21:45:57 +00:00 committed by Stan Hu
parent 3a8e1fe937
commit 8184ce7fb7
19 changed files with 56 additions and 12 deletions

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class AbuseReportMailer < BaseMailer
def notify(abuse_report_id)
return unless deliverable?

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class BaseMailer < ActionMailer::Base
around_action :render_with_default_locale

View file

@ -1,3 +1,5 @@
# 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

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EmailRejectionMailer < BaseMailer
def rejection(reason, original_raw, can_retry = false)
@reason = reason

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Emails
module Issues
def new_issue_email(recipient_id, issue_id, reason = nil)

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Emails
module Members
extend ActiveSupport::Concern

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Emails
module MergeRequests
def new_merge_request_email(recipient_id, merge_request_id, reason = nil)

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Emails
module Notes
def note_commit_email(recipient_id, note_id)

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Emails
module PagesDomains
def pages_domain_enabled_email(domain, recipient)

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Emails
module Pipelines
def pipeline_success_email(pipeline, recipients)
@ -39,10 +41,10 @@ module Emails
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

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Emails
module Profile
def new_user_email(user_id, token = nil)

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Emails
module Projects
def project_was_moved_email(project_id, user_id, old_path_with_namespace)

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class Notify < BaseMailer
include ActionDispatch::Routing::PolymorphicRoutes
include GitlabRoutingHelper
@ -92,12 +94,14 @@ class Notify < BaseMailer
# >> 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.

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class DeviseMailerPreview < ActionMailer::Preview
def confirmation_instructions_for_signup
DeviseMailer.confirmation_instructions(unsaved_user, 'faketoken', {})

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class EmailRejectionMailerPreview < ActionMailer::Preview
def rejection
EmailRejectionMailer.rejection("some rejection reason", "From: someone@example.com\nraw email here").message

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class NotifyPreview < ActionMailer::Preview
def note_merge_request_email_for_individual_note
note_email(:note_merge_request_email) do

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class RepositoryCheckMailerPreview < ActionMailer::Preview
def notify
RepositoryCheckMailer.notify(3).message

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
class RepositoryCheckMailer < BaseMailer
def notify(failed_count)
@message =

View file

@ -0,0 +1,5 @@
---
title: Enable frozen in app/mailers/**/*.rb
merge_request: 21147
author: gfyoung
type: performance