From f8359bd77d5f056773248ee4a4fc1f0baade4bd5 Mon Sep 17 00:00:00 2001 From: Raphael Sofaer Date: Fri, 8 Apr 2011 10:36:39 -0700 Subject: [PATCH] Fix PeopleController#show mobile --- app/controllers/people_controller.rb | 2 +- app/views/people/show.mobile.haml | 2 +- spec/controllers/people_controller_spec.rb | 10 ++++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index b334b4af3..f9d053eb4 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -87,7 +87,7 @@ class PeopleController < ApplicationController @contacts_of_contact = [] end - if (@person != current_user.person) && (!@contact || @contact.pending) + if (@person != current_user.person) && (!@contact || !@contact.persisted? || @contact.pending) @commenting_disabled = true else @commenting_disabled = false diff --git a/app/views/people/show.mobile.haml b/app/views/people/show.mobile.haml index 7bd5d378b..837774fa8 100644 --- a/app/views/people/show.mobile.haml +++ b/app/views/people/show.mobile.haml @@ -10,7 +10,7 @@ - if user_signed_in? && !(@contact.persisted? || current_user.person == @person) .right = link_to "start sharing", - {:controller => "contact", + {:controller => "contacts", :action => "new", :id => @person.id}, :class => 'share_with button', diff --git a/spec/controllers/people_controller_spec.rb b/spec/controllers/people_controller_spec.rb index ce849185e..e923c8a1b 100644 --- a/spec/controllers/people_controller_spec.rb +++ b/spec/controllers/people_controller_spec.rb @@ -200,6 +200,11 @@ describe PeopleController do get :show, :id => @person.id assigns(:posts).models.should =~ posts_user_can_see end + + it 'sets @commenting_disabled to true' do + get :show, :id => @person.id + assigns(:commenting_disabled).should == false + end end context "when the person is not a contact of the current user" do @@ -227,6 +232,11 @@ describe PeopleController do get :show, :id => @person.id assigns[:posts].models.should =~ [public_post] end + + it 'sets @commenting_disabled to true' do + get :show, :id => @person.id + assigns(:commenting_disabled).should == true + end end end