public
Description: The open source social networking platform in Ruby on Rails from the author of RailsSpace
Homepage: http://insoshi.com
Clone URL: git://github.com/insoshi/insoshi.git
Search Repo:
Status message for people who are contacts
Michael Hartl (author)
Sun Mar 23 15:09:41 -0700 2008
commit  86647757a86392bf51e702bb244c207cb1371574
tree    cbe034a9eaf07aa07bc2bf2198c8f70f5fb8d05b
parent  f2df17d908f59d54add040edfd36c6d93aad7130
...
40
41
42
 
 
43
44
45
...
79
80
81
 
 
 
 
 
 
 
 
82
83
84
...
40
41
42
43
44
45
46
47
...
81
82
83
84
85
86
87
88
89
90
91
92
93
94
0
@@ -40,6 +40,8 @@
0
     def exists?(person, contact)
0
       not conn(person, contact).nil?
0
     end
0
+
0
+ alias exist? exists?
0
   
0
     # Make a pending connection request.
0
     def request(person, contact, mail = EMAIL_NOTIFICATIONS)
0
@@ -79,6 +81,14 @@
0
     # Return a connection based on the person and contact.
0
     def conn(person, contact)
0
       find_by_person_id_and_contact_id(person, contact)
0
+ end
0
+
0
+ def accepted?(person, contact)
0
+ conn(person, contact).status == ACCEPTED
0
+ end
0
+
0
+ def connected?(person, contact)
0
+ exist?(person, contact) and accepted?(person, contact)
0
     end
0
   end
0
   
...
9
10
11
 
 
 
12
13
14
...
9
10
11
12
13
14
15
16
17
0
@@ -9,6 +9,9 @@
0
       <%= link_to "Connect with #{@person.name}!",
0
                   person_connections_path(@person), :method => :post %>
0
     <%- end -%>
0
+ <%- if logged_in? and Connection.connected?(@person, current_person) -%>
0
+ | <%= @person.name %> is one of your contacts
0
+ <%- end -%>
0
   <%- end -%>
0
 
0
   <div>
...
64
65
66
 
67
68
69
...
64
65
66
67
68
69
70
0
@@ -64,6 +64,7 @@
0
       respond_to do |format|
0
         format.html do
0
           store_location
0
+ flash[:error] = "You must log in to access this page."
0
           redirect_to login_url
0
         end
0
         format.any do

Comments

    No one has commented yet.