diff options
author | Xavier Priour <xavier.priour@bubblyware.com> | 2015-12-13 20:02:51 +0100 |
---|---|---|
committer | Xavier Priour <xavier.priour@bubblyware.com> | 2015-12-13 20:02:51 +0100 |
commit | e304185c23014fe3a4511d213535549e4bfeb207 (patch) | |
tree | 1e3a33f06db36b52f9bbfafb6163a652883a0cdf /client/components/sidebar/sidebar.js | |
parent | 18697d45f652a119ba21b0cef42fbf732902bfa9 (diff) | |
parent | 0954cff5b470712210275a9c0699d85d6579ab54 (diff) | |
download | wekan-e304185c23014fe3a4511d213535549e4bfeb207.tar.gz wekan-e304185c23014fe3a4511d213535549e4bfeb207.tar.bz2 wekan-e304185c23014fe3a4511d213535549e4bfeb207.zip |
Merge remote-tracking branch 'upstream/devel' into devel
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); }, }); |