public
Description: The open source social networking platform in Ruby on Rails from the author of RailsSpace
Homepage: http://insoshi.com
Clone URL: git://github.com/insoshi/insoshi.git
Search Repo:
Added app name to subject lines
Michael Hartl (author)
Tue May 13 11:18:27 -0700 2008
commit  292658c0d3ece68ff48ebd51614d32d1facadeaf
tree    2e8cbac80d9c74a424a8faee11b39ba3784f7de1
parent  97372b508f01f351484d1ad1060288ee2a1ae7a7
...
12
13
14
15
 
16
17
18
19
20
21
22
 
23
24
25
26
27
28
29
 
30
31
32
...
36
37
38
39
 
40
41
42
...
47
48
49
50
 
51
52
53
54
55
...
55
56
57
58
59
60
61
62
 
63
64
65
66
67
 
 
 
 
 
 
 
68
69
70
...
12
13
14
 
15
16
17
18
19
20
21
 
22
23
24
25
26
27
28
 
29
30
31
32
...
36
37
38
 
39
40
41
42
...
47
48
49
 
50
51
52
53
54
55
...
55
56
57
 
 
58
59
 
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
0
@@ -12,21 +12,21 @@
0
   def password_reminder(person)
0
     from "Password reminder <password-reminder@#{server}>"
0
     recipients person.email
0
- subject "Password reminder"
0
+ subject formatted_subject("Password reminder")
0
     body "domain" => server, "person" => person
0
   end
0
   
0
   def message_notification(message)
0
     from "Message notification <message@#{server}>"
0
     recipients message.recipient.email
0
- subject "New message"
0
+ subject formatted_subject("New message")
0
     body "domain" => server, "message" => message
0
   end
0
   
0
   def connection_request(connection)
0
     from "Contact request <connection@#{server}>"
0
     recipients connection.contact.email
0
- subject "New contact request"
0
+ subject formatted_subject("New contact request")
0
     body "domain" => server,
0
                  "connection" => connection,
0
                  "url" => edit_connection_path(connection),
0
@@ -36,7 +36,7 @@
0
   def blog_comment_notification(comment)
0
     from "Comment notification <comment@#{server}>"
0
     recipients comment.commented_person.email
0
- subject "New blog comment"
0
+ subject formatted_subject("New blog comment")
0
     body "domain" => server, "comment" => comment,
0
                  "url" =>
0
                  blog_post_path(comment.commentable.blog, comment.commentable),
0
@@ -47,7 +47,7 @@
0
   def wall_comment_notification(comment)
0
     from "Comment notification <comment@#{server}>"
0
     recipients comment.commented_person.email
0
- subject "New blog comment"
0
+ subject formatted_subject("New wall comment")
0
     body "domain" => server, "comment" => comment,
0
                  "url" => person_path(comment.commentable, :anchor => "wall"),
0
                  "preferences_note" =>
0
0
0
@@ -55,16 +55,21 @@
0
   end
0
   
0
   def email_verification(ev)
0
- name = PersonMailer.global_prefs.app_name
0
- label = name.nil? || name.blank? ? "" : "[#{name}] "
0
     from "Email verification <email@#{server}>"
0
     recipients ev.person.email
0
- subject "#{label}Email verification"
0
+ subject formatted_subject("Email verification")
0
     body "server_name" => server,
0
                  "code" => ev.code
0
   end
0
   
0
   private
0
+
0
+ # Prepend the application name to subjects if present in preferences.
0
+ def formatted_subject(text)
0
+ name = PersonMailer.global_prefs.app_name
0
+ label = name.blank? ? "" : "[#{name}] "
0
+ "#{label}#{text}"
0
+ end
0
   
0
     def preferences_note(person)
0
       %(To change your email notification preferences, visit
...
3
4
5
 
6
7
8
...
3
4
5
6
7
8
9
0
@@ -3,6 +3,7 @@
0
 one:
0
   domain: example.com
0
   server_name: server.example.net
0
+ app_name: Example
0
   smtp_server: smtp.example.com
0
   email_notifications: true
0
   email_verifications: false
...
149
150
151
 
 
 
 
152
153
154
...
149
150
151
152
153
154
155
156
157
158
0
@@ -149,6 +149,10 @@
0
        @email.to.first.should == @ev.person.email
0
      end
0
      
0
+ it "should have the right subject" do
0
+ @email.subject.should == "[Example] Email verification"
0
+ end
0
+
0
      it "should have a URL to the verification page" do
0
        url = "http://#{@server}/people/verify/#{@ev.code}"
0
        @email.body.should =~ /#{url}/

Comments

    No one has commented yet.