made mailer query based on ids, rather than making them serialize ruby objects

This commit is contained in:
maxwell 2010-11-04 15:13:09 -07:00
parent 363f76aed9
commit 4154cec28a
2 changed files with 12 additions and 12 deletions

View file

@ -4,20 +4,20 @@ class Notifier < ActionMailer::Base
default :from => "no-reply@joindiaspora.com" default :from => "no-reply@joindiaspora.com"
ATTACHMENT = File.read("#{Rails.root}/public/images/diaspora_white_on_grey.png") ATTACHMENT = File.read("#{Rails.root}/public/images/diaspora_white_on_grey.png")
def new_request(recipient, sender) def new_request(recipient_id, sender_id)
puts "I'm in new request" @receiver = User.find_by_id(recipient_id)
@receiver = recipient @sender = Person.find_by_id(sender.id)
@sender = sender
attachments.inline['diaspora_white_on_grey.png'] = ATTACHMENT
attachments.inline['diaspora_white_on_grey.png'] = ATTACHMENT
mail(:to => "#{recipient.real_name} <#{recipient.email}>", mail(:to => "#{recipient.real_name} <#{recipient.email}>",
:subject => "new Diaspora* friend request from #{@sender.real_name}", :host => APP_CONFIG[:terse_pod_url]) :subject => "new Diaspora* friend request from #{@sender.real_name}", :host => APP_CONFIG[:terse_pod_url])
end end
def request_accepted(recipient, sender, aspect) def request_accepted(recipient_id, sender_id, aspect_id)
@receiver = recipient @receiver = User.find_by_id(recipient_id)
@sender = sender @sender = Person.find_by_id(sender_id)
@aspect = aspect @aspect = Aspect.find_by_id(aspect_id)
attachments.inline['diaspora_white_on_grey.png'] = ATTACHMENT attachments.inline['diaspora_white_on_grey.png'] = ATTACHMENT
mail(:to => "#{recipient.real_name} <#{recipient.email}>", mail(:to => "#{recipient.real_name} <#{recipient.email}>",
@ -26,10 +26,10 @@ class Notifier < ActionMailer::Base
def self.send_request_accepted!(user, person, aspect) def self.send_request_accepted!(user, person, aspect)
Notifier.async.request_accepted(user, person, aspect ).deliver.commit! Notifier.async.request_accepted(user.id, person.id, aspect.id ).deliver.commit!
end end
def self.send_new_request!(user, person) def self.send_new_request!(user, person)
Notifier.async.new_request(user, person).deliver.commit! Notifier.async.new_request(user.id, person.id).deliver.commit!
end end
end end

View file

@ -50,5 +50,5 @@ fi
mkdir -p -v log/thin/ mkdir -p -v log/thin/
bundle exec ruby ./script/websocket_server.rb& bundle exec ruby ./script/websocket_server.rb&
bundle exec magent start& bundle exec magent start -d
bundle exec thin start $args bundle exec thin start $args