Cleaned up code, to follow the ruby style guidelines

This commit is contained in:
echarp 2016-10-31 22:35:14 +01:00
parent 83f803d5fb
commit 786eb5ee2a
4 changed files with 15 additions and 14 deletions

View File

@ -12,7 +12,8 @@ class EventMailer < ApplicationMailer
subject: event.title}"
end
# Send email to submitter too. Before, only moderators were receiving emails when an event was updated
# Send email to submitter too. Before, only moderators were receiving emails
# when an event was updated
def update(event)
@event = event
@current_user = User.find_by id: event.paper_trail.originator

View File

@ -58,7 +58,7 @@ class ModerationorgaMailer < ApplicationMailer
mail 'In-Reply-To' =>
"<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>",
subject: "#{t 'mail_prefix'}#{t 'moderationorga_mailer.destroy.subject',
subject: orga.name}"
subject: t('mail_prefix') + t('moderationorga_mailer.destroy.subject',
subject: orga.name)
end
end

View File

@ -25,18 +25,18 @@ class EventCallbacks
end
def self.after_update(event)
return unless ActionMailer::Base.default_url_options[:host]
if event.moderated_changed? && event.moderated?
tweet event
if ActionMailer::Base.default_url_options[:host]
# Send an acceptation mail to its author
EventMailer.accept(event).deliver_now
# Send an acceptation mail to moderators
ModerationMailer.accept(event).deliver_now
end
elsif ActionMailer::Base.default_url_options[:host]
else
# Send an update mail to moderators
ModerationMailer.update(event).deliver_now