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 its author
EventMailer.accept(event).deliver_now
# Send an acceptation mail to moderators
ModerationMailer.accept(event).deliver_now
end
# Send an acceptation mail to moderators
ModerationMailer.accept(event).deliver_now
elsif ActionMailer::Base.default_url_options[:host]
else
# Send an update mail to moderators
ModerationMailer.update(event).deliver_now

View File

@ -51,11 +51,11 @@ class Orga < ActiveRecord::Base
if moderated_changed?
OrgaMailer.accept(self).deliver_now!
# Send email to moderators when an orga is accepted
# Send email to moderators when an orga is accepted
ModerationorgaMailer.accept(self).deliver_now!
else
OrgaMailer.update(self).deliver_now!
# Send email to moderators when an orga is updated
# Send email to moderators when an orga is updated
ModerationorgaMailer.update(self).deliver_now!
end
end
@ -63,13 +63,13 @@ class Orga < ActiveRecord::Base
before_destroy do
OrgaMailer.destroy(self).deliver_now! unless submitter.blank?
# Send email to moderators when an orga is deleted
# Send email to moderators when an orga is deleted
ModerationorgaMailer.destroy(self).deliver_now! unless submitter.blank?
end
def send_secret
OrgaMailer.create(self).deliver_now!
# Send email to moderators when an new orga is received
# Send email to moderators when an new orga is received
ModerationorgaMailer.create(self).deliver_now!
end