File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ class Message
1818
1919 def send_notification
2020 recipient_email = Hacker . first ( :username => self . recipient ) . email
21- Notifier . send_message_notification ( recipient_email )
21+ Notifier . send_message_notification ( recipient_email , self . sender )
2222 end
2323
2424end
Original file line number Diff line number Diff line change 11class Notifier
2- def self . send_message_notification ( recipient )
2+ def self . send_message_notification ( recipient , who )
33 Pony . mail ( :to => recipient ,
44 :subject => "Hackety Hack: New Message" ,
55 :from => "steve+hackety@steveklabnik.com" ,
6- :body => render_haml_template ( "message" ) ,
6+ :body => render_haml_template ( "message" , who ) ,
77 :via => :smtp , :via_options => PONY_VIA_OPTIONS )
88 end
99
1010 private
1111
12- def self . render_haml_template ( template )
13- engine = Haml ::Engine . new ( File . open ( "views/notifier/#{ template } .haml" , "rb" ) . read )
12+ def self . render_haml_template ( template , who )
13+ engine = Haml ::Engine . new ( File . open ( "views/notifier/#{ template } .haml" , "rb" ) . read , :who => who )
1414 engine . render
1515 end
1616end
Original file line number Diff line number Diff line change 1- The Hackety Hack Robot
1+ Hey there! You have a new message on the Hackety Hack site from #{@who}! You can check it out here:
2+
3+ http://hackety-hack.com/messages
4+
5+ \- The Hackety Hack Robot
You can’t perform that action at this time.
0 commit comments