 # globally accessible method for getting the URL of a user's avatar
 window.avatarUrl = (user, img_size) -> 
   user = fetch(user)
-  (fetch('/application').asset_host or '') + \
-        "/system/avatars/" + \
-        "#{user.key.split('/')[2]}/#{img_size}/#{user.avatar_file_name}"  
-
+  if !!user.avatar_file_name
+    (fetch('/application').asset_host or '') + \
+          "/system/avatars/" + \
+          "#{user.key.split('/')[2]}/#{img_size}/#{user.avatar_file_name}"  
+  else 
+    null
 
 
 user_name = (user, anon) -> 

    # the broken text ugliness by using img { text-indent: -10000px } to 
    # hide the alt text / broken image
    attrs.alt = ""
  
  tag attrs,
    if add_initials
      fontsize = style.width / 2
      ff = 'monaco,Consolas,"Lucida Console",monospace'
      if name == 'Anonymous'
        name = '?'

      if name.length == 2
        name = "#{name[0][0]}#{name[1][0]}"
      else 
        name = "#{name[0][0]}"

      DIV
        style: 
          color: 'white'
          pointerEvents: 'none'
          fontSize: fontsize
          position: 'relative'
          fontFamily: ff
          top: .3 * fontsize #style.height / 2 - heightWhenRendered(name, {fontSize: fontsize, fontFamily: ff}) / 2
          overflow: 'hidden'
        name

        DIV 
          className: 'hidden'
          tooltip






window.avatar = (user, props) ->
  attrs = _.clone props

  if !user.key 
    if user == arest.cache['/current_user']?.user 
