Skip to content
Extraits de code Groupes Projets
Valider 93ebbbb6 rédigé par Raphael's avatar Raphael
Parcourir les fichiers

put some logging in the mailer

parent 062593ee
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -8,8 +8,10 @@ class Notifier < ActionMailer::Base ...@@ -8,8 +8,10 @@ class Notifier < ActionMailer::Base
@receiver = User.find_by_id(recipient_id) @receiver = User.find_by_id(recipient_id)
@sender = Person.find_by_id(sender_id) @sender = Person.find_by_id(sender_id)
log_mail(recipient_id, sender_id, 'new_request')
attachments.inline['diaspora_white_on_grey.png'] = ATTACHMENT attachments.inline['diaspora_white_on_grey.png'] = ATTACHMENT
mail(:to => "#{@receiver.real_name} <#{@receiver.email}>", mail(:to => "#{@receiver.real_name} <#{@receiver.email}>",
:subject => I18n.t('notifier.new_request.subject', :from => @sender.real_name), :host => APP_CONFIG[:terse_pod_url]) :subject => I18n.t('notifier.new_request.subject', :from => @sender.real_name), :host => APP_CONFIG[:terse_pod_url])
end end
...@@ -18,9 +20,23 @@ class Notifier < ActionMailer::Base ...@@ -18,9 +20,23 @@ class Notifier < ActionMailer::Base
@receiver = User.find_by_id(recipient_id) @receiver = User.find_by_id(recipient_id)
@sender = Person.find_by_id(sender_id) @sender = Person.find_by_id(sender_id)
@aspect = Aspect.find_by_id(aspect_id) @aspect = Aspect.find_by_id(aspect_id)
log_mail(recipient_id, sender_id, 'request_accepted')
attachments.inline['diaspora_white_on_grey.png'] = ATTACHMENT attachments.inline['diaspora_white_on_grey.png'] = ATTACHMENT
mail(:to => "#{@receiver.real_name} <#{@receiver.email}>", mail(:to => "#{@receiver.real_name} <#{@receiver.email}>",
:subject => I18n.t('notifier.request_accepted.subject', :name => @sender.real_name), :host => APP_CONFIG[:terse_pod_url]) :subject => I18n.t('notifier.request_accepted.subject', :name => @sender.real_name), :host => APP_CONFIG[:terse_pod_url])
end end
private
def log_mail recipient_id, sender_id, type
log_string = "event=mail mail_type=#{type} db_name=#{MongoMapper.database.name} recipient_id=#{recipient_id} sender_id=#{sender_id}"
if @receiver && @sender
log_string << "models_found=true sender_handle=#{@sender.diaspora_handle} recipient_handle=#{@receiver.diaspora_handle}"
else
log_string << "models_found=false"
end
Rails.logger.info log_string
end
end end
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter