fix post vis batch update

This commit is contained in:
Maxwell Salzberg 2011-07-29 19:36:15 -07:00
parent 7504f66416
commit 5e5671ecf8

View file

@ -30,10 +30,10 @@ module Diaspora
def register_post_visibilities(contact) def register_post_visibilities(contact)
#should have select here, but proven hard to test #should have select here, but proven hard to test
posts = Post.where(:author_id => contact.person_id, :public => true).limit(100) posts = Post.where(:author_id => contact.person_id, :public => true).limit(100)
posts.map! do |post| p = posts.map do |post|
PostVisibility.new(:contact_id => contact.id, :post_id => post.id) PostVisibility.new(:contact_id => contact.id, :post_id => post.id)
end end
PostVisibility.import(posts) unless posts.empty? PostVisibility.import(p) unless posts.empty?
nil nil
end end