diff --git a/app/models/person.rb b/app/models/person.rb index d190dfc1b..caf229ae1 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -215,6 +215,10 @@ class Person < ActiveRecord::Base def to_twitter(format=:json) end + def has_photos? + self.posts.where(:type => "Photo").exists? + end + protected def clean_url diff --git a/app/views/photos/_new_profile_photo.haml b/app/views/photos/_new_profile_photo.haml index 5795d965f..4846b8da8 100644 --- a/app/views/photos/_new_profile_photo.haml +++ b/app/views/photos/_new_profile_photo.haml @@ -13,7 +13,7 @@ %p #fileInfo - -if !aspect.nil? && aspect != :getting_started + -if !aspect.nil? && aspect != :getting_started && current_user.person.has_photos? %br %br %p diff --git a/spec/models/person_spec.rb b/spec/models/person_spec.rb index 913093690..6a8646884 100644 --- a/spec/models/person_spec.rb +++ b/spec/models/person_spec.rb @@ -374,4 +374,15 @@ describe Person do end end end + describe '#has_photos?' do + it 'returns false if the user has no photos' do + alice.person.has_photos?.should be_false + end + + it 'returns true if the user has photos' do + alice.post(:photo, :user_file => uploaded_photo, :to => alice.aspects.first.id) + + alice.person.has_photos?.should be_true + end + end end