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:
authorJonne Haß <me@mrzyx.de>2012-09-09 15:14:02 +0400
committerJonne Haß <me@mrzyx.de>2012-09-23 21:33:19 +0400
commite70e48d6caf5c3a314ba8896b37c6b98b7edc816 (patch)
tree88dc1f0a1864999c5de28b11bb399e0fa2e927cc /lib/stream/base.rb
parentf0619dbbfdfe1a52a5cee6de3c67632c2e6d8714 (diff)
some refactoring regarding the law of demeter
Diffstat (limited to 'lib/stream/base.rb')
-rw-r--r--lib/stream/base.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/stream/base.rb b/lib/stream/base.rb
index 8cbdb2b78..601cb1298 100644
--- a/lib/stream/base.rb
+++ b/lib/stream/base.rb
@@ -100,7 +100,7 @@ class Stream::Base
def like_posts_for_stream!(posts)
return posts unless @user
- likes = Like.where(:author_id => @user.person.id, :target_id => posts.map(&:id), :target_type => "Post")
+ likes = Like.where(:author_id => @user.person_id, :target_id => posts.map(&:id), :target_type => "Post")
like_hash = likes.inject({}) do |hash, like|
hash[like.target_id] = like
@@ -133,7 +133,7 @@ class Stream::Base
def post_is_from_contact?(post)
@can_comment_cache ||= {}
@can_comment_cache[post.id] ||= contacts_in_stream.find{|contact| contact.person_id == post.author.id}.present?
- @can_comment_cache[post.id] ||= (user.person.id == post.author.id)
+ @can_comment_cache[post.id] ||= (user.person_id == post.author_id)
@can_comment_cache[post.id]
end
end