gitlab-org--gitlab-foss/app/mailers/application_mailer.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
904 B
Ruby
Raw Normal View History

2018-08-15 21:45:57 +00:00
# frozen_string_literal: true
class ApplicationMailer < ActionMailer::Base
around_action :render_with_default_locale
helper ApplicationHelper
helper MarkupHelper
attr_accessor :current_user
helper_method :current_user, :can?
2017-03-31 15:11:28 +00:00
default from: proc { default_sender_address.format }
default reply_to: proc { default_reply_to_address.format }
def can?
2016-08-08 18:55:13 +00:00
Ability.allowed?(current_user, action, subject)
end
private
def render_with_default_locale(&block)
Gitlab::I18n.with_default_locale(&block)
end
def default_sender_address
address = Mail::Address.new(Gitlab.config.gitlab.email_from)
address.display_name = Gitlab.config.gitlab.email_display_name
address
end
def default_reply_to_address
address = Mail::Address.new(Gitlab.config.gitlab.email_reply_to)
address.display_name = Gitlab.config.gitlab.email_display_name
address
end
end