fix small commenting email bug #oops

This commit is contained in:
Maxwell Salzberg 2011-11-04 19:24:48 -07:00
parent 2c12b94e67
commit a552fc80c0
2 changed files with 7 additions and 1 deletions

View file

@ -59,7 +59,7 @@ class Comment < ActiveRecord::Base
end
def notification_type(user, person)
if self.post.author == user.person
if (self.post.author == user.person) && (self.author != user.person)
return Notifications::CommentOnPost
elsif self.post.comments.where(:author_id => user.person.id) != [] && self.author_id != user.person.id
return Notifications::AlsoCommented

View file

@ -36,6 +36,12 @@ describe Comment do
@comment.notification_type(alice, alice.person).should == Notifications::AlsoCommented
end
end
it 'should not return if you are author of the object being commented on' do
p = Factory(:status_message, :author => bob.person)
c = bob.comment("dfs", :post => p)
c.notification_type(bob, bob.person).should be_false
end
end
describe 'User#comment' do