show a user's full profile info if she's on her own page. duh.
This commit is contained in:
parent
d5f511c325
commit
1b6c33aff5
3 changed files with 7 additions and 6 deletions
|
|
@ -24,8 +24,6 @@ app.pages.Profile = app.views.Base.extend({
|
|||
presenter : function(){
|
||||
var bio = this.model.get("bio") || ''
|
||||
|
||||
console.log(this.defaultPresenter().current_user)
|
||||
|
||||
return _.extend(this.defaultPresenter(),
|
||||
{text : this.model && app.helpers.textFormatter(bio, this.model),
|
||||
isOwnProfile : this.isOwnProfile(),
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class ProfilesController < ApplicationController
|
|||
public_json = @person.as_api_response(:backbone)
|
||||
extra_json = {}
|
||||
|
||||
if(current_user && current_user.contacts.receiving.where(:person_id => @person.id).first)
|
||||
if(current_user && (current_user.person == @person || current_user.contacts.receiving.where(:person_id => @person.id).first))
|
||||
extra_json = {
|
||||
:location => @person.profile.location,
|
||||
:birthday => @person.profile.formatted_birthday,
|
||||
|
|
|
|||
|
|
@ -24,9 +24,6 @@ describe ProfilesController do
|
|||
|
||||
it "returns the user's public information if a user is logged in and the visiting user is not receiving" do
|
||||
sign_in :user, alice
|
||||
|
||||
puts alice.contacts.first.person.inspect
|
||||
|
||||
get :show, :id => @user.person.guid, :format => :json
|
||||
response.body.should_not match(/.location./)
|
||||
end
|
||||
|
|
@ -36,6 +33,12 @@ describe ProfilesController do
|
|||
get :show, :id => @user.person.guid, :format => :json
|
||||
response.body.should match(/.location./)
|
||||
end
|
||||
|
||||
it "returns the user's private information if a user is logged in as herself" do
|
||||
sign_in :user, eve
|
||||
get :show, :id => @user.person.guid, :format => :json
|
||||
response.body.should match(/.location./)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#edit' do
|
||||
|
|
|
|||
Loading…
Reference in a new issue