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:
Benjamin Neff 2016-07-08 20:40:44 +02:00
parent 488860d2f0
commit f9476409c8
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
2 changed files with 16 additions and 0 deletions

View file

@ -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]

View file

@ -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) }