Cleaned up code, to follow the ruby style guidelines
This commit is contained in:
parent
83f803d5fb
commit
786eb5ee2a
|
@ -12,7 +12,8 @@ class EventMailer < ApplicationMailer
|
||||||
subject: event.title}"
|
subject: event.title}"
|
||||||
end
|
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)
|
def update(event)
|
||||||
@event = event
|
@event = event
|
||||||
@current_user = User.find_by id: event.paper_trail.originator
|
@current_user = User.find_by id: event.paper_trail.originator
|
||||||
|
|
|
@ -58,7 +58,7 @@ class ModerationorgaMailer < ApplicationMailer
|
||||||
|
|
||||||
mail 'In-Reply-To' =>
|
mail 'In-Reply-To' =>
|
||||||
"<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
"<orga-#{orga.id}@#{ActionMailer::Base.default_url_options[:host]}>",
|
||||||
subject: "#{t 'mail_prefix'}#{t 'moderationorga_mailer.destroy.subject',
|
subject: t('mail_prefix') + t('moderationorga_mailer.destroy.subject',
|
||||||
subject: orga.name}"
|
subject: orga.name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -25,18 +25,18 @@ class EventCallbacks
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.after_update(event)
|
def self.after_update(event)
|
||||||
|
return unless ActionMailer::Base.default_url_options[:host]
|
||||||
|
|
||||||
if event.moderated_changed? && event.moderated?
|
if event.moderated_changed? && event.moderated?
|
||||||
tweet event
|
tweet event
|
||||||
|
|
||||||
if ActionMailer::Base.default_url_options[:host]
|
# Send an acceptation mail to its author
|
||||||
# Send an acceptation mail to its author
|
EventMailer.accept(event).deliver_now
|
||||||
EventMailer.accept(event).deliver_now
|
|
||||||
|
|
||||||
# Send an acceptation mail to moderators
|
# Send an acceptation mail to moderators
|
||||||
ModerationMailer.accept(event).deliver_now
|
ModerationMailer.accept(event).deliver_now
|
||||||
end
|
|
||||||
|
|
||||||
elsif ActionMailer::Base.default_url_options[:host]
|
else
|
||||||
# Send an update mail to moderators
|
# Send an update mail to moderators
|
||||||
ModerationMailer.update(event).deliver_now
|
ModerationMailer.update(event).deliver_now
|
||||||
|
|
||||||
|
|
|
@ -51,11 +51,11 @@ class Orga < ActiveRecord::Base
|
||||||
|
|
||||||
if moderated_changed?
|
if moderated_changed?
|
||||||
OrgaMailer.accept(self).deliver_now!
|
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!
|
ModerationorgaMailer.accept(self).deliver_now!
|
||||||
else
|
else
|
||||||
OrgaMailer.update(self).deliver_now!
|
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!
|
ModerationorgaMailer.update(self).deliver_now!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -63,13 +63,13 @@ class Orga < ActiveRecord::Base
|
||||||
|
|
||||||
before_destroy do
|
before_destroy do
|
||||||
OrgaMailer.destroy(self).deliver_now! unless submitter.blank?
|
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?
|
ModerationorgaMailer.destroy(self).deliver_now! unless submitter.blank?
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_secret
|
def send_secret
|
||||||
OrgaMailer.create(self).deliver_now!
|
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!
|
ModerationorgaMailer.create(self).deliver_now!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue