From dc6018103381d0b594668a91fff6be66342e075e Mon Sep 17 00:00:00 2001
From: maxwell <maxwell@joindiaspora.com>
Date: Tue, 22 Mar 2011 11:26:39 -0700
Subject: [PATCH] 404 googlebotz left and right on public remote person pages

---
 app/controllers/people_controller.rb       | 6 ++++++
 spec/controllers/people_controller_spec.rb | 7 +++++++
 2 files changed, 13 insertions(+)

diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb
index 1ee4d787be..452724bc81 100644
--- a/app/controllers/people_controller.rb
+++ b/app/controllers/people_controller.rb
@@ -50,6 +50,12 @@ class PeopleController < ApplicationController
 
   def show
     @person = Person.where(:id => params[:id]).first
+    if @person && @person.remote? && !user_signed_in?
+      render :file => "#{Rails.root}/public/404.html", :layout => false, :status => 404
+      return
+    end
+
+
     @post_type = :all
     @aspect = :profile
     @share_with = (params[:share_with] == 'true')
diff --git a/spec/controllers/people_controller_spec.rb b/spec/controllers/people_controller_spec.rb
index e20ada7451..73d18d99d7 100644
--- a/spec/controllers/people_controller_spec.rb
+++ b/spec/controllers/people_controller_spec.rb
@@ -154,6 +154,13 @@ describe PeopleController do
 
         assigns[:posts].should =~ public_posts
       end
+
+      it 'throws 404 if the person is remote' do
+        p = Factory(:person)
+
+        get :show, :id => p.id
+        response.status.should == 404
+      end
     end
     context "when the person is a contact of the current user" do
       before do
-- 
GitLab