Send public profiles publicly
this will help big profiles, and the informations are public anyway, so no need to encrypt them. fixes #3164
This commit is contained in:
parent
488860d2f0
commit
f9476409c8
2 changed files with 16 additions and 0 deletions
|
|
@ -40,6 +40,10 @@ class Profile < ActiveRecord::Base
|
|||
Person.joins(:contacts).where(contacts: {user_id: person.owner_id})
|
||||
end
|
||||
|
||||
def public?
|
||||
public_details?
|
||||
end
|
||||
|
||||
def diaspora_handle
|
||||
#get the parent diaspora handle, unless we want to access a profile without a person
|
||||
(self.person) ? self.person.diaspora_handle : self[:diaspora_handle]
|
||||
|
|
|
|||
|
|
@ -185,6 +185,18 @@ describe Profile, :type => :model do
|
|||
end
|
||||
end
|
||||
|
||||
describe "public?" do
|
||||
it "is public if public_details is true" do
|
||||
profile = FactoryGirl.build(:profile, public_details: true)
|
||||
expect(profile.public?).to be_truthy
|
||||
end
|
||||
|
||||
it "is not public if public_details is false" do
|
||||
profile = FactoryGirl.build(:profile, public_details: false)
|
||||
expect(profile.public?).to be_falsey
|
||||
end
|
||||
end
|
||||
|
||||
describe 'date=' do
|
||||
let(:profile) { FactoryGirl.build(:profile) }
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue