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:
No email notifications for comments on own blog/wall, or for messages to 
self
Michael Hartl (author)
Wed May 14 10:33:00 -0700 2008
commit  f073e77861aa482fa316ee646b0ff81ef5889b28
tree    dc12c97bed9c0a7c7594390877bd5867ddf07030
parent  2f611925ded407bc89926611103888091405d702
...
74
75
76
 
77
78
79
...
74
75
76
77
78
79
80
0
@@ -74,6 +74,7 @@
0
     end
0
     
0
     def send_receipt_reminder
0
+ return if commenter == commented_person
0
       if wall_comment?
0
         @send_mail ||= Comment.global_prefs.email_notifications? &&
0
                        commented_person.wall_comment_notifications?
...
144
145
146
 
147
148
149
...
144
145
146
147
148
149
150
0
@@ -144,6 +144,7 @@
0
     end
0
     
0
     def send_receipt_reminder
0
+ return if sender == recipient
0
       @send_mail ||= Message.global_prefs.email_notifications? &&
0
                      recipient.message_notifications?
0
       PersonMailer.deliver_message_notification(self) if @send_mail
...
82
83
84
85
 
86
87
88
89
90
91
92
 
93
 
 
 
 
 
 
 
94
95
96
97
...
154
155
156
157
 
158
159
160
161
162
163
164
 
 
 
 
 
 
 
 
165
166
167
...
82
83
84
 
85
86
87
88
89
90
91
 
92
93
94
95
96
97
98
99
100
101
102
103
104
...
161
162
163
 
164
165
166
167
168
169
170
 
171
172
173
174
175
176
177
178
179
180
181
0
@@ -82,15 +82,22 @@
0
         @recipient.blog_comment_notifications.should == false
0
         lambda do
0
           @comment.save
0
- end.should_not change(@emails, :length).by(1)
0
+ end.should_not change(@emails, :length)
0
       end
0
       
0
       it "should not send an email when global notifications are off" do
0
         @global_prefs.update_attributes(:email_notifications => false)
0
         lambda do
0
           @comment.save
0
- end.should_not change(@emails, :length).by(1)
0
+ end.should_not change(@emails, :length)
0
       end
0
+
0
+ it "should not send an email for an own-comment" do
0
+ lambda do
0
+ @post.comments.create(:body => "Hey there",
0
+ :commenter => @post.blog.person)
0
+ end.should_not change(@emails, :length)
0
+ end
0
     end
0
   end
0
 
0
0
@@ -154,14 +161,21 @@
0
         @recipient.wall_comment_notifications.should == false
0
         lambda do
0
           @comment.save
0
- end.should_not change(@emails, :length).by(1)
0
+ end.should_not change(@emails, :length)
0
       end
0
     
0
       it "should not send an email when global notifications are off" do
0
         @global_prefs.update_attributes(:email_notifications => false)
0
         lambda do
0
           @comment.save
0
- end.should_not change(@emails, :length).by(1)
0
+ end.should_not change(@emails, :length)
0
+ end
0
+
0
+ it "should not send an email for an own-comment" do
0
+ lambda do
0
+ @person.comments.create(:body => "Hey there",
0
+ :commenter => @person)
0
+ end.should_not change(@emails, :length)
0
       end
0
     end
0
   end
...
31
32
33
34
 
35
36
37
38
39
40
41
 
42
43
44
...
31
32
33
 
34
35
36
37
38
39
40
 
41
42
43
44
0
@@ -31,14 +31,14 @@
0
       @contact.connection_notifications.should == false
0
       lambda do
0
         Connection.request(@person, @contact)
0
- end.should_not change(@emails, :length).by(1)
0
+ end.should_not change(@emails, :length)
0
     end
0
     
0
     it "should not send an email when global notifications are off" do
0
       @global_prefs.update_attributes(:email_notifications => false)
0
       lambda do
0
         Connection.request(@person, @contact)
0
- end.should_not change(@emails, :length).by(1)
0
+ end.should_not change(@emails, :length)
0
     end
0
     
0
     it "should accept a request" do
...
102
103
104
105
 
106
107
108
109
110
111
112
 
113
 
 
 
 
 
 
114
115
116
...
102
103
104
 
105
106
107
108
109
110
111
 
112
113
114
115
116
117
118
119
120
121
122
0
@@ -102,15 +102,21 @@
0
       @recipient.message_notifications.should == false
0
       lambda do
0
         @message.save
0
- end.should_not change(@emails, :length).by(1)
0
+ end.should_not change(@emails, :length)
0
     end
0
     
0
     it "should not send an email when global notifications are off" do
0
       @global_prefs.update_attributes(:email_notifications => false)
0
       lambda do
0
         @message.save
0
- end.should_not change(@emails, :length).by(1)
0
+ end.should_not change(@emails, :length)
0
     end
0
+
0
+ it "should not send an email for an own-message" do
0
+ lambda do
0
+ create_message(:sender => @sender, :recipient => @sender)
0
+ end.should_not change(@emails, :length)
0
+ end
0
   end
0
 
0
 

Comments

    No one has commented yet.