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
path: root/lib
diff options
context:
space:
mode:
authorMaxwell Salzberg <maxwell@joindiaspora.com>2011-07-30 04:20:10 +0400
committerMaxwell Salzberg <maxwell@joindiaspora.com>2011-07-30 04:20:10 +0400
commit73616a3e7a43daf97fd1dedd32e66efd6be8f14f (patch)
treecc9d8acab54ba1b42ffc5463eda2067b81b93f1a /lib
parenta320891df0ee439d2a2bd86257dc6417454875b1 (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.rb13
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