{% load rules i18n %}
{% has_perm 'core.view_avatar_rule' request.user person_or_user as can_view_avatar %}
{% has_perm 'core.view_photo_rule' request.user person_or_user as can_view_photo %}
{% if SITE_PREFERENCES.account__person_prefer_photo and person_or_user.photo and can_view_photo %}
{% elif person_or_user.identicon_url %}
{# If this is a person #}
{% if can_view_avatar %}
{% else %}
{% endif %}
{% else %}
{# There is a user without a person #}
person
{% endif %}