summaryrefslogtreecommitdiffstats
path: root/client/components/users/userAvatar.js
blob: d7d221db10ea38fc7d5103d241cbbd5b4061ee43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Template.userAvatar.helpers({
  userData: function() {
    if (! this.user) {
      this.user = Users.findOne(this.userId);
    }
    return this.user;
  },
  memberType: function() {
    var userId = this.userId || this.user._id;
    var user = Users.findOne(userId);
    return user && user.isBoardAdmin() ? 'admin' : 'normal';
  },
  presenceStatusClassName: function() {
    var userPresence = Presences.findOne({ userId: this.user._id });
    if (! userPresence)
      return 'disconnected';
    else if (Session.equals('currentBoard', userPresence.state.currentBoardId))
      return 'active';
    else
      return 'idle';
  }
});