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

29 lines
727 B
Ruby
Raw Normal View History

2015-08-19 15:51:42 -04:00
class BaseMailer < ActionMailer::Base
helper ApplicationHelper
helper MarkupHelper
attr_accessor :current_user
helper_method :current_user, :can?
2017-03-31 11:11:28 -04:00
default from: proc { default_sender_address.format }
default reply_to: proc { default_reply_to_address.format }
def can?
2016-08-08 14:55:13 -04:00
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