diff options
author | floatinghotpot <rjfun.mobile@gmail.com> | 2015-12-08 16:03:31 +0800 |
---|---|---|
committer | floatinghotpot <rjfun.mobile@gmail.com> | 2015-12-08 16:03:31 +0800 |
commit | 672c21bfe043c557c059086561113a6a1dfefb42 (patch) | |
tree | 07a01706d6f8abba1ee7aeb393c991db28ef3b15 /models/users.js | |
parent | b719968df5577af6dd69eb32f6c2e2a43a322e87 (diff) | |
download | wekan-672c21bfe043c557c059086561113a6a1dfefb42.tar.gz wekan-672c21bfe043c557c059086561113a6a1dfefb42.tar.bz2 wekan-672c21bfe043c557c059086561113a6a1dfefb42.zip |
bugfix: only care active members, also optimize some code
Diffstat (limited to 'models/users.js')
-rw-r--r-- | models/users.js | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/models/users.js b/models/users.js index 2c9ae380..cf4c4193 100644 --- a/models/users.js +++ b/models/users.js @@ -12,16 +12,12 @@ if (Meteor.isClient) { Users.helpers({ isBoardMember() { const board = Boards.findOne(Session.get('currentBoard')); - return board && - _.contains(_.pluck(board.members, 'userId'), this._id) && - _.where(board.members, {userId: this._id})[0].isActive; + return board && board.hasMember(this._id); }, isBoardAdmin() { const board = Boards.findOne(Session.get('currentBoard')); - return board && - this.isBoardMember(board) && - _.where(board.members, {userId: this._id})[0].isAdmin; + return board && board.hasAdmin(this._id); }, }); } |