Skip to content

Commit

Permalink
Allow private posts in flow if author
Browse files Browse the repository at this point in the history
  • Loading branch information
makaroni4 committed Aug 9, 2012
1 parent fea8279 commit a9896f1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/user.rb
Expand Up @@ -37,7 +37,7 @@ def flow
tag_ids = subscriptions.select(:tag_id).to_sql
user_ids = followings.select(:followed_user_id).to_sql
conditions = []
conditions << "posts.user_id = #{id} and posts.is_private = 'f'"
conditions << "posts.user_id = #{id}"
conditions << "taggings.tag_id in (#{tag_ids}) and posts.is_private = 'f'"
conditions << "posts.user_id in (#{user_ids}) and posts.is_private = 'f'"
Post.joins(:taggings).where(conditions.join(' or ')).uniq
Expand Down
4 changes: 2 additions & 2 deletions spec/models/user_spec.rb
Expand Up @@ -43,9 +43,9 @@
subject.flow.should_not include(post)
end

it 'should not show self private posts' do
it 'should show self private posts' do
post = create(:private_post, user: user)
subject.flow.should_not include(post)
subject.flow.should include(post)
end
end

Expand Down

0 comments on commit a9896f1

Please sign in to comment.