gitlab-org--gitlab-foss/app/mailers/base_mailer.rb
2017-04-02 12:48:43 +03:00

28 lines
735 B
Ruby

class BaseMailer < ActionMailer::Base
helper ApplicationHelper
helper GitlabMarkdownHelper
attr_accessor :current_user
helper_method :current_user, :can?
default from: proc { default_sender_address.format }
default reply_to: proc { default_reply_to_address.format }
def can?
Ability.allowed?(current_user, action, subject)
end
private
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