diff options
author | Maxwell Salzberg <maxwell@joindiaspora.com> | 2011-07-30 04:20:10 +0400 |
---|---|---|
committer | Maxwell Salzberg <maxwell@joindiaspora.com> | 2011-07-30 04:20:10 +0400 |
commit | 73616a3e7a43daf97fd1dedd32e66efd6be8f14f (patch) | |
tree | cc9d8acab54ba1b42ffc5463eda2067b81b93f1a /lib | |
parent | a320891df0ee439d2a2bd86257dc6417454875b1 (diff) |
new users now autofollow diasporahq@joindiaspora.com; upon connecting to a user, you now get post visibilities for their public posts (that your pod knows about)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/diaspora/user/connecting.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/diaspora/user/connecting.rb b/lib/diaspora/user/connecting.rb index 668ab2709..3500d461d 100644 --- a/lib/diaspora/user/connecting.rb +++ b/lib/diaspora/user/connecting.rb @@ -22,10 +22,21 @@ module Diaspora if notification = Notification.where(:target_id => person.id).first notification.update_attributes(:unread=>false) end - + + register_post_visibilities(contact) contact end + def register_post_visibilities(contact) + #should have select here, but proven hard to test + posts = Post.where(:author_id => contact.person_id, :public => true).limit(100) + posts.map! do |post| + PostVisibility.new(:contact_id => contact.id, :post_id => post.id) + end + PostVisibility.import(posts) unless posts.empty? + nil + end + def remove_contact(contact, opts={:force => false}) posts = contact.posts.all |