it can somehow happen that a person has no profile. somehow. idk why.
This commit is contained in:
parent
86cc7a0d35
commit
20e1316491
2 changed files with 3 additions and 3 deletions
|
|
@ -148,7 +148,7 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def person_image_link(person, opts = {})
|
def person_image_link(person, opts = {})
|
||||||
return "" if person.nil?
|
return "" if person.nil? || person.profile.nil?
|
||||||
if opts[:to] == :photos
|
if opts[:to] == :photos
|
||||||
link_to person_image_tag(person, opts[:size]), person_photos_path(person)
|
link_to person_image_tag(person, opts[:size]), person_photos_path(person)
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ class Person < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def name(opts = {})
|
def name(opts = {})
|
||||||
@name ||= if profile.first_name.nil? || profile.first_name.blank?
|
@name ||= if profile.nil? || profile.first_name.nil? || profile.first_name.blank?
|
||||||
self.diaspora_handle
|
self.diaspora_handle
|
||||||
else
|
else
|
||||||
"#{profile.first_name.to_s} #{profile.last_name.to_s}"
|
"#{profile.first_name.to_s} #{profile.last_name.to_s}"
|
||||||
|
|
@ -83,7 +83,7 @@ class Person < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def first_name
|
def first_name
|
||||||
@first_name ||= if profile.first_name.nil? || profile.first_name.blank?
|
@first_name ||= if profile.nil? || profile.first_name.nil? || profile.first_name.blank?
|
||||||
self.diaspora_handle.split('@').first
|
self.diaspora_handle.split('@').first
|
||||||
else
|
else
|
||||||
profile.first_name.to_s
|
profile.first_name.to_s
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue