app/models/user.rb
# simple friend check from friends_hash cache. Initialized in fetch_user / cache_friend_info in app. controller
# 1) logged in user         - show detailed info + clickable user div
# 2) mutual friends         - show detailed info + clickable user div
# 3) follows (F)            - show few info + clickable user div
# 4) stalked by (S)         - show few info + clickable user div
# 5) deselected api friends - show few info + not clickable user div
# 6) friends of friends     - show few info + not clickable user div
# 7) friends proposals      - not clickable user div 
# 8) others                 - not clickable user div
simple friend check from friends_hash cache. Initialized in fetch_user / cache_friend_info in app.
simple friend check from friends_hash cache . Initialized in fetch_user / cache_friend_info in app .
def friend? (login_users)
    return 8 unless [Array, ActiveRecord::Relation::ActiveRecord_Relation_User].index(login_users.class) 
    return 8 if login_users.size == 0 
    return 8 if login_users.first.dummy_user?
    login_user = login_users.find { |user| user.provider == self.provider }
    return 8 unless login_user
    if !login_user.friends_hash
      logger.warn2 "no friends cache was found for login user #{login_user.debug_info}"
      return 8
    end
    return login_user.friends_hash[user_id] || 8
  end
def friend? ( login_users ) return 8 unless [ Array , ActiveRecord :: Relation :: ActiveRecord_Relation_User ] . index ( login_users . class ) return 8 if login_users . size == 0 return 8 if login_users . first . dummy_user? login_user = login_users . find { | user | user . provider == self . provider } return 8 unless login_user if ! login_user . friends_hash logger . warn2 "no friends cache was found for login user #{login_user.debug_info}" return 8 end return login_user . friends_hash [ user_id ] || 8 end
simple friend check from friends_hash cache.
simple friend check from friends_hash cache .
# logger.debug2  "login_users.class = #{login_users.class}" # not logged in # logger.debug2  "login_users.size = #{login_users.size}" # not logged in
login_users
<not_specific>