From 4243d8efca3197d139ddfbe21c25b71a8bde2829 Mon Sep 17 00:00:00 2001
From: maxwell <maxwell@joindiaspora.com>
Date: Mon, 9 Aug 2010 12:19:26 -0700
Subject: [PATCH] MS IZ using the particular user's friends in the
 send_friend_request_to

---
 app/models/user.rb | 2 +-
 db/seeds/tom.rb    | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/app/models/user.rb b/app/models/user.rb
index b9199fcf7b..a520a579f6 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -31,7 +31,7 @@ class User
 
   ######### Friend Requesting
   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)
       if p.save
         p.push_to_url friend_url
diff --git a/db/seeds/tom.rb b/db/seeds/tom.rb
index d180c3a7d9..17b9375ca9 100644
--- a/db/seeds/tom.rb
+++ b/db/seeds/tom.rb
@@ -18,3 +18,10 @@ user = User.create( :email => "tom@tom.joindiaspora.com",
                   )
 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
-- 
GitLab