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
Switched to proper server name for links & addresses
Michael Hartl (author)
Tue May 13 11:08:52 -0700 2008
commit  97372b508f01f351484d1ad1060288ee2a1ae7a7
tree    bd4b16eb885510c2d6d5f294dc3ac786c4de071f
parent  faa135714bdad1d1b2e0e050fcedaaa10eb6bece
...
5
6
7
 
 
 
 
8
9
 
10
11
12
 
13
14
15
16
 
17
18
19
 
20
21
22
23
 
24
25
26
 
27
28
29
30
31
32
33
 
34
35
36
 
37
38
39
...
41
42
43
44
 
45
46
47
 
48
49
50
...
53
54
55
56
 
57
58
59
 
60
61
62
...
65
66
67
68
 
69
70
...
5
6
7
8
9
10
11
12
 
13
14
15
 
16
17
18
19
 
20
21
22
 
23
24
25
26
 
27
28
29
 
30
31
32
33
34
35
36
 
37
38
39
 
40
41
42
43
...
45
46
47
 
48
49
50
 
51
52
53
54
...
57
58
59
 
60
61
62
 
63
64
65
66
...
69
70
71
 
72
73
74
0
@@ -5,35 +5,39 @@ class PersonMailer < ActionMailer::Base
0
     @domain ||= PersonMailer.global_prefs.domain
0
   end
0
   
0
+ def server
0
+ @server_name ||= PersonMailer.global_prefs.server_name
0
+ end
0
+
0
   def password_reminder(person)
0
- from "Password reminder <password-reminder@#{domain}>"
0
+ from "Password reminder <password-reminder@#{server}>"
0
     recipients person.email
0
     subject "Password reminder"
0
- body "domain" => domain, "person" => person
0
+ body "domain" => server, "person" => person
0
   end
0
   
0
   def message_notification(message)
0
- from "Message notification <message@#{domain}>"
0
+ from "Message notification <message@#{server}>"
0
     recipients message.recipient.email
0
     subject "New message"
0
- body "domain" => domain, "message" => message
0
+ body "domain" => server, "message" => message
0
   end
0
   
0
   def connection_request(connection)
0
- from "Contact request <connection@#{domain}>"
0
+ from "Contact request <connection@#{server}>"
0
     recipients connection.contact.email
0
     subject "New contact request"
0
- body "domain" => domain,
0
+ body "domain" => server,
0
                  "connection" => connection,
0
                  "url" => edit_connection_path(connection),
0
                  "preferences_note" => preferences_note(connection.contact)
0
   end
0
   
0
   def blog_comment_notification(comment)
0
- from "Comment notification <comment@#{domain}>"
0
+ from "Comment notification <comment@#{server}>"
0
     recipients comment.commented_person.email
0
     subject "New blog comment"
0
- body "domain" => domain, "comment" => comment,
0
+ body "domain" => server, "comment" => comment,
0
                  "url" =>
0
                  blog_post_path(comment.commentable.blog, comment.commentable),
0
                  "preferences_note" =>
0
@@ -41,10 +45,10 @@ class PersonMailer < ActionMailer::Base
0
   end
0
   
0
   def wall_comment_notification(comment)
0
- from "Comment notification <comment@#{domain}>"
0
+ from "Comment notification <comment@#{server}>"
0
     recipients comment.commented_person.email
0
     subject "New blog comment"
0
- body "domain" => domain, "comment" => comment,
0
+ body "domain" => server, "comment" => comment,
0
                  "url" => person_path(comment.commentable, :anchor => "wall"),
0
                  "preferences_note" =>
0
                     preferences_note(comment.commented_person)
0
@@ -53,10 +57,10 @@ class PersonMailer < ActionMailer::Base
0
   def email_verification(ev)
0
     name = PersonMailer.global_prefs.app_name
0
     label = name.nil? || name.blank? ? "" : "[#{name}] "
0
- from "Email verification <email@#{domain}>"
0
+ from "Email verification <email@#{server}>"
0
     recipients ev.person.email
0
     subject "#{label}Email verification"
0
- body "server_name" => PersonMailer.global_prefs.server_name,
0
+ body "server_name" => server,
0
                  "code" => ev.code
0
   end
0
   
0
@@ -65,6 +69,6 @@ class PersonMailer < ActionMailer::Base
0
     def preferences_note(person)
0
       %(To change your email notification preferences, visit
0
       
0
-http://#{domain}/people/#{person.to_param}/edit)
0
+http://#{server}/people/#{person.to_param}/edit)
0
     end
0
 end
...
2
3
4
 
5
6
7
...
2
3
4
5
6
7
8
0
@@ -2,6 +2,7 @@
0
 
0
 one:
0
   domain: example.com
0
+ server_name: server.example.net
0
   smtp_server: smtp.example.com
0
   email_notifications: true
0
   email_verifications: false
...
4
5
6
 
7
8
9
...
13
14
15
16
 
17
18
19
...
32
33
34
35
 
36
37
38
...
40
41
42
43
 
44
45
46
...
62
63
64
65
 
66
67
68
69
70
 
71
72
73
74
 
 
75
76
77
...
94
95
96
97
 
98
99
100
101
102
103
104
 
 
105
106
107
...
124
125
126
127
 
128
129
130
131
132
133
 
134
135
136
...
147
148
149
150
 
151
152
153
154
155
 
156
157
158
159
...
4
5
6
7
8
9
10
...
14
15
16
 
17
18
19
20
...
33
34
35
 
36
37
38
39
...
41
42
43
 
44
45
46
47
...
63
64
65
 
66
67
68
69
70
 
71
72
73
74
 
75
76
77
78
79
...
96
97
98
 
99
100
101
102
103
104
105
 
106
107
108
109
110
...
127
128
129
 
130
131
132
133
134
135
 
136
137
138
139
...
150
151
152
 
153
154
155
156
157
 
158
159
160
161
162
0
@@ -4,6 +4,7 @@ describe PersonMailer do
0
   
0
   before(:each) do
0
     @preferences = preferences(:one)
0
+ @server = @preferences.server_name
0
   end
0
   
0
   describe "password reminder" do
0
@@ -13,7 +14,7 @@ describe PersonMailer do
0
      end
0
    
0
      it "should have the right sender" do
0
- @email.from.first.should == "password-reminder@example.com"
0
+ @email.from.first.should == "password-reminder@#{@server}"
0
      end
0
    
0
      it "should have the right recipient" do
0
@@ -32,7 +33,7 @@ describe PersonMailer do
0
      end
0
    
0
      it "should have the right sender" do
0
- @email.from.first.should == "message@example.com"
0
+ @email.from.first.should == "message@#{@server}"
0
      end
0
    
0
      it "should have the right recipient" do
0
@@ -40,7 +41,7 @@ describe PersonMailer do
0
      end
0
 
0
      it "should have the right domain in the body" do
0
- @email.body.should =~ /#{@preferences.domain}/
0
+ @email.body.should =~ /#{@server}/
0
      end
0
    end
0
    
0
@@ -62,16 +63,17 @@ describe PersonMailer do
0
      end
0
      
0
      it "should have a URL to the connection" do
0
- url = "http://#{@preferences.domain}/connections/#{@connection.id}/edit"
0
+ url = "http://#{@server}/connections/#{@connection.id}/edit"
0
        @email.body.should =~ /#{url}/
0
      end
0
    
0
      it "should have the right domain in the body" do
0
- @email.body.should =~ /#{@preferences.domain}/
0
+ @email.body.should =~ /#{@server}/
0
      end
0
      
0
      it "should have a link to the recipient's preferences" do
0
- prefs_url = "#{@preferences.domain}/people/#{@contact.to_param}/edit"
0
+ prefs_url = "http://#{@server}"
0
+ prefs_url += "/people/#{@contact.to_param}/edit"
0
        @email.body.should =~ /#{prefs_url}/
0
      end
0
    end
0
@@ -94,14 +96,15 @@ describe PersonMailer do
0
      end
0
      
0
      it "should have a link to the comment" do
0
- url = "http://#{@preferences.domain}"
0
+ url = "http://#{@server}"
0
        url += "/blogs/#{@comment.commentable.blog.to_param}"
0
        url += "/posts/#{@comment.commentable.to_param}"
0
        @email.body.should =~ /#{url}/
0
      end
0
      
0
      it "should have a link to the recipient's preferences" do
0
- prefs_url = "#{@preferences.domain}/people/#{@recipient.to_param}/edit"
0
+ prefs_url = "http://#{@server}/people/"
0
+ prefs_url += "#{@recipient.to_param}/edit"
0
        @email.body.should =~ /#{prefs_url}/
0
      end
0
    end
0
@@ -124,13 +127,13 @@ describe PersonMailer do
0
      end
0
      
0
      it "should have a link to the comment" do
0
- url = "http://#{@preferences.domain}"
0
+ url = "http://#{@server}"
0
        url += "/people/#{@comment.commentable.to_param}#wall"
0
        @email.body.should =~ /#{url}/
0
      end
0
      
0
      it "should have a link to the recipient's preferences" do
0
- prefs_url = "#{@preferences.domain}/people/#{@recipient.to_param}/edit"
0
+ prefs_url = "#{@server}/people/#{@recipient.to_param}/edit"
0
        @email.body.should =~ /#{prefs_url}/
0
      end
0
    end
0
@@ -147,12 +150,12 @@ describe PersonMailer do
0
      end
0
      
0
      it "should have a URL to the verification page" do
0
- url = "/people/verify/#{@ev.code}"
0
+ url = "http://#{@server}/people/verify/#{@ev.code}"
0
        @email.body.should =~ /#{url}/
0
      end
0
 
0
      it "should have the right server name in the body" do
0
- @email.body.should =~ /#{@preferences.server_name}/
0
+ @email.body.should =~ /#{@server}/
0
      end
0
    end
0
 end
0
\ No newline at end of file

Comments

    No one has commented yet.