Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/models/comment.rb2
-rw-r--r--spec/models/comment_spec.rb6
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