Cleaned up code, to follow the ruby style guidelines

rails5
echarp 6 years ago
parent 83f803d5fb
commit 786eb5ee2a
  1. 3
      app/mailers/event_mailer.rb
  2. 4
      app/mailers/moderationorga_mailer.rb
  3. 14
      app/models/event_callbacks.rb
  4. 8
      app/models/orga.rb

@ -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

@ -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

@ -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

@ -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

Loading…
Cancel
Save