diff options
Diffstat (limited to 'client/components/sidebar/sidebar.js')
-rw-r--r-- | client/components/sidebar/sidebar.js | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/client/components/sidebar/sidebar.js b/client/components/sidebar/sidebar.js index 5b58dbd9..ec3ebcf6 100644 --- a/client/components/sidebar/sidebar.js +++ b/client/components/sidebar/sidebar.js @@ -279,7 +279,7 @@ BlazeComponent.extendComponent({ 'click .js-select-member'() { const userId = this.currentData()._id; const currentBoard = Boards.findOne(Session.get('currentBoard')); - if (currentBoard.memberIndex(userId)<0) { + if (!currentBoard.hasMember(userId)) { this.inviteUser(userId); } }, @@ -305,16 +305,12 @@ Template.changePermissionsPopup.events({ Template.changePermissionsPopup.helpers({ isAdmin() { - const user = Users.findOne(this.userId); - return user.isBoardAdmin(); + const currentBoard = Boards.findOne(Session.get('currentBoard')); + return currentBoard.hasAdmin(this.userId); }, isLastAdmin() { - const user = Users.findOne(this.userId); - if (!user.isBoardAdmin()) - return false; const currentBoard = Boards.findOne(Session.get('currentBoard')); - const nbAdmins = _.where(currentBoard.members, { isAdmin: true }).length; - return nbAdmins === 1; + return currentBoard.hasAdmin(this.userId) && (currentBoard.activeAdmins() === 1); }, }); |