We were very inconsistent regarding these rules. Personally I prefer no empty lines around blocks, clases, etc... as recommended by the Ruby style guide [1], and they're the default values in rubocop, so those are the settings I'm applying. The exception is the `private` access modifier, since we were leaving empty lines around it most of the time. That's the default rubocop rule as well. Personally I don't have a strong preference about this one. [1] https://rubystyle.guide/#empty-lines-around-bodies
47 lines
1.4 KiB
Ruby
47 lines
1.4 KiB
Ruby
class Dashboard::Mailer < ApplicationMailer
|
|
layout "mailer"
|
|
after_action :check_deliverability
|
|
|
|
def forward(proposal)
|
|
@proposal = proposal
|
|
mail to: proposal.author.email, subject: proposal.title
|
|
end
|
|
|
|
def new_actions_notification_rake_published(proposal, new_actions_ids)
|
|
@proposal = proposal
|
|
@new_actions = get_new_actions(new_actions_ids)
|
|
mail to: proposal.author.email,
|
|
subject: I18n.t("mailers.new_actions_notification_rake_published.subject")
|
|
end
|
|
|
|
def new_actions_notification_rake_created(proposal, new_actions_ids)
|
|
@proposal = proposal
|
|
@new_actions = get_new_actions(new_actions_ids)
|
|
mail to: proposal.author.email,
|
|
subject: I18n.t("mailers.new_actions_notification_rake_created.subject")
|
|
end
|
|
|
|
def new_actions_notification_on_create(proposal)
|
|
@proposal = proposal
|
|
mail to: proposal.author.email,
|
|
subject: I18n.t("mailers.new_actions_notification_on_create.subject")
|
|
end
|
|
|
|
def new_actions_notification_on_published(proposal, new_actions_ids)
|
|
@proposal = proposal
|
|
@new_actions = get_new_actions(new_actions_ids)
|
|
mail to: proposal.author.email,
|
|
subject: I18n.t("mailers.new_actions_notification_on_published.subject")
|
|
end
|
|
|
|
private
|
|
|
|
def get_new_actions(new_actions_ids)
|
|
Dashboard::Action.where(id: new_actions_ids)
|
|
end
|
|
|
|
def check_deliverability
|
|
mail.perform_deliveries = false unless Setting["dashboard.emails"]
|
|
end
|
|
end
|