From ec8aed12bb248e85c254b4f61385ac698d366b6c Mon Sep 17 00:00:00 2001
From: Raphael Sofaer <raphael@joindiaspora.com>
Date: Wed, 23 Mar 2011 10:13:30 -0700
Subject: [PATCH] Limit similar contacts, need a see all page

---
 app/controllers/people_controller.rb | 6 ++++--
 app/views/people/show.html.haml      | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb
index 452724bc81..fbacc7ff02 100644
--- a/app/controllers/people_controller.rb
+++ b/app/controllers/people_controller.rb
@@ -11,7 +11,7 @@ class PeopleController < ApplicationController
   def index
     @aspect = :search
     params[:q] ||= params[:term]
-    
+
     if (params[:q][0] == 35 || params[:q][0] == '#') && params[:q].length > 1
       redirect_to "/tags/#{params[:q].gsub("#", "")}"
       return
@@ -71,10 +71,12 @@ class PeopleController < ApplicationController
         if @contact
           @aspects_with_person = @contact.aspects
           @aspect_ids = @aspects_with_person.map(&:id)
-          @contacts_of_contact = @contact.contacts
+          @contacts_of_contact_count = @contact.contacts.count
+          @contacts_of_contact = @contact.contacts.limit(36)
 
         else
           @contact ||= Contact.new
+          @contacts_of_contact_count = 0
           @contacts_of_contact = []
         end
 
diff --git a/app/views/people/show.html.haml b/app/views/people/show.html.haml
index 9acbd7e6f5..d70723fca2 100644
--- a/app/views/people/show.html.haml
+++ b/app/views/people/show.html.haml
@@ -17,7 +17,7 @@
       %hr{:style=>"width:300px;"}
       .section.contact_pictures
         %h4
-          = @contacts_of_contact.length
+          = @contacts_of_contact_count
           = t('.similar_contacts')
         - for person in @contacts_of_contact
           = person_image_link person
-- 
GitLab