Show:

Streams.Avatar Class

Extends Base.Streams.Avatar
Module: Streams

Class representing 'Avatar' rows in the 'Streams' database
stored primarily on publisherId's shard

Constructor

Streams.Avatar

(
  • fields
)

Parameters:

  • fields Object

    The fields values to initialize table row as an associative array of {column: value} pairs

Item Index

Methods

Methods

displayName

(
  • [options]
  • [fallback='Someone']
)
String

Get the display name from a Streams.Avatar

Parameters:

  • [options] Object optional

    A bunch of options which can include:

    • [short] Boolean optional

      Show one part of the name only

    • [show] Boolean optional

      The parts of the name to show. Can have "f", "fu", "l", "lu", "flu" and "u" separated by spaces. The "fu" and "lu" represent firstname or lastname with fallback to username, while "flu" is "firstname lastname" with a fallback to username.

    • [html] Boolean optional

      If true, encloses the first name, last name, username in span tags. If an array, then it will be used as the attributes of the html.

    • [escape] Boolean optional

      If true, does HTML escaping of the retrieved fields

  • [fallback='Someone'] String optional

    What to return if there is no info to get displayName from.

Returns:

fetch

(
  • toUserId
  • publisherId
  • callback
)
static

Fetches a Streams.Avatar object. The Streams plugin maintains an avatar for every user that authenticates the app.

Parameters:

  • toUserId String

    The user to which the avatar will be displayed

  • publisherId String

    The user publishing the avatar

  • callback Function

    Receives (err, avatar)

setUp

()

The setUp() method is called the first time an object of this class is constructed.

toArray

()

Get plain object representing the row, as well as displayName and shortName