debian-mirror-gitlab/app/mailers/base_mailer.rb

29 lines
727 B
Ruby
Raw Normal View History

2015-09-25 12:07:36 +05:30
class BaseMailer < ActionMailer::Base
2017-08-17 22:00:37 +05:30
helper ApplicationHelper
helper MarkupHelper
2015-09-25 12:07:36 +05:30
attr_accessor :current_user
helper_method :current_user, :can?
2017-08-17 22:00:37 +05:30
default from: proc { default_sender_address.format }
default reply_to: proc { default_reply_to_address.format }
2015-09-25 12:07:36 +05:30
def can?
2016-09-29 09:46:39 +05:30
Ability.allowed?(current_user, action, subject)
2015-09-25 12:07:36 +05:30
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