MS IZ using the particular user's friends in the send_friend_request_to

This commit is contained in:
maxwell 2010-08-09 12:19:26 -07:00
parent ac7530d17f
commit 4243d8efca
2 changed files with 8 additions and 1 deletions

View file

@ -31,7 +31,7 @@ class User
######### Friend Requesting ######### Friend Requesting
def send_friend_request_to(friend_url) def send_friend_request_to(friend_url)
unless Person.where(:url => friend_url).first unless self.friends.where(:url => friend_url).first
p = Request.instantiate(:to => friend_url, :from => self.person) p = Request.instantiate(:to => friend_url, :from => self.person)
if p.save if p.save
p.push_to_url friend_url p.push_to_url friend_url

View file

@ -18,3 +18,10 @@ user = User.create( :email => "tom@tom.joindiaspora.com",
) )
user.person.save user.person.save
user2 = User.create( :email => "korth@tom.joindiaspora.com",
:password => "evankorth",
:person => Person.new( :email => "korth@tom.joindiaspora.com",
:url => "http://tom.joindiaspora.com/",
:profile => Profile.new( :first_name => "Evan",
:last_name => "Korth")))
user2.person.save