diff options
author | Maxwell Salzberg <maxwell@joindiaspora.com> | 2011-11-05 06:24:48 +0400 |
---|---|---|
committer | Maxwell Salzberg <maxwell@joindiaspora.com> | 2011-11-05 06:24:48 +0400 |
commit | a552fc80c09449bf4e507dfd20918a5061f45b05 (patch) | |
tree | 9415c403cd21dc0729b6a04cd13916c2ea66deca | |
parent | 2c12b94e6752abe24c41cf09c93c3a6ec09c861a (diff) |
fix small commenting email bug #oops
-rw-r--r-- | app/models/comment.rb | 2 | ||||
-rw-r--r-- | spec/models/comment_spec.rb | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/app/models/comment.rb b/app/models/comment.rb index 16edcf412..c9e8f6c2c 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -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 diff --git a/spec/models/comment_spec.rb b/spec/models/comment_spec.rb index be158ca61..3aa492737 100644 --- a/spec/models/comment_spec.rb +++ b/spec/models/comment_spec.rb @@ -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 |