diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index 226f3233b..28b5de57d 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -12,12 +12,11 @@ class PeopleController < ApplicationController end def show - @person= current_user.visible_person_by_id(params[:id]) - - @person_profile = @person.profile - @person_posts = Post.where(:person_id => @person.id).paginate :page => params[:page], :order => 'created_at DESC' + @person = current_user.visible_person_by_id(params[:id]) + @profile = @person.profile + @posts = Post.find_all_by_person_id(@person.id).paginate :page => params[:page], :order => 'created_at DESC' @latest_status_message = StatusMessage.newest_for(@person) - @post_count = @person_posts.count + @post_count = @posts.count end def destroy diff --git a/app/models/user.rb b/app/models/user.rb index dfadaef68..12067eee7 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -281,7 +281,7 @@ class User end def visible_person_by_id( id ) - return self if id == self.id + return self.person if ensure_bson(id) == self.person.id friends.detect{|x| x.id == ensure_bson( id ) } end diff --git a/app/views/people/show.html.haml b/app/views/people/show.html.haml index b29699997..af8eb86ab 100644 --- a/app/views/people/show.html.haml +++ b/app/views/people/show.html.haml @@ -6,13 +6,13 @@ %h1 = @person.real_name - unless @person.id == current_user.id - .button.right - = link_to 'remove friend', @person, :confirm => 'Are you sure?', :method => :delete + .right + = link_to 'remove friend', @person, :confirm => 'Are you sure?', :method => :delete, :class => "button" %ul - -unless @person_posts.first.nil? + -unless @posts.first.nil? %li - %i= "last seen: #{how_long_ago(@person_posts.first)}" + %i= "last seen: #{how_long_ago(@posts.first)}" %li %i= "friends since: #{how_long_ago(@person)}" %li @@ -26,11 +26,11 @@ %span="posted: #{how_long_ago(@latest_status_message)}" .span-20.last - - if @person.posts + - if @posts %h3= "stream - #{@post_count} item(s)" %ul#stream - - for post in @person_posts + - for post in @posts = render type_partial(post), :post => post - = will_paginate @person_posts + = will_paginate @posts - else %h3 no posts to display!