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 /client/components | |
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 'client/components')
-rw-r--r-- | client/components/cards/cardDetails.jade | 2 | ||||
-rw-r--r-- | client/components/lists/listBody.js | 2 | ||||
-rw-r--r-- | client/components/main/editor.js | 2 | ||||
-rw-r--r-- | client/components/sidebar/sidebar.js | 12 | ||||
-rw-r--r-- | client/components/sidebar/sidebarFilters.jade | 46 |
5 files changed, 29 insertions, 35 deletions
diff --git a/client/components/cards/cardDetails.jade b/client/components/cards/cardDetails.jade index 9d2cbec7..5746c92c 100644 --- a/client/components/cards/cardDetails.jade +++ b/client/components/cards/cardDetails.jade @@ -94,7 +94,7 @@ template(name="moveCardPopup") template(name="cardMembersPopup") ul.pop-over-list.js-card-member-list - each board.members + each board.activeMembers li.item(class="{{#if isCardMember}}active{{/if}}") a.name.js-select-member(href="#") +userAvatar(userId=user._id) diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js index 36b60d06..1fc84c82 100644 --- a/client/components/lists/listBody.js +++ b/client/components/lists/listBody.js @@ -186,7 +186,7 @@ BlazeComponent.extendComponent({ match: /\B@(\w*)$/, search(term, callback) { const currentBoard = Boards.findOne(Session.get('currentBoard')); - callback($.map(currentBoard.members, (member) => { + callback($.map(currentBoard.activeMembers(), (member) => { const user = Users.findOne(member.userId); return user.username.indexOf(term) === 0 ? user : null; })); diff --git a/client/components/main/editor.js b/client/components/main/editor.js index 82fce641..a30a5e1d 100644 --- a/client/components/main/editor.js +++ b/client/components/main/editor.js @@ -28,7 +28,7 @@ Template.editor.onRendered(() => { match: /\B@(\w*)$/, search(term, callback) { const currentBoard = Boards.findOne(Session.get('currentBoard')); - callback(currentBoard.members.map((member) => { + callback(currentBoard.activeMembers().map((member) => { const username = Users.findOne(member.userId).username; return username.includes(term) ? username : null; })); 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); }, }); diff --git a/client/components/sidebar/sidebarFilters.jade b/client/components/sidebar/sidebarFilters.jade index ef26ef76..0e935e3f 100644 --- a/client/components/sidebar/sidebarFilters.jade +++ b/client/components/sidebar/sidebarFilters.jade @@ -18,17 +18,16 @@ template(name="filterSidebar") i.fa.fa-check hr ul.sidebar-list - each currentBoard.members - if isActive - with getUser userId - li(class="{{#if Filter.members.isSelected _id}}active{{/if}}") - a.name.js-toggle-member-filter - +userAvatar(userId=this._id) - span.sidebar-list-item-description - = profile.fullname - | (<span class="username">{{ username }}</span>) - if Filter.members.isSelected _id - i.fa.fa-check + each currentBoard.activeMembers + with getUser userId + li(class="{{#if Filter.members.isSelected _id}}active{{/if}}") + a.name.js-toggle-member-filter + +userAvatar(userId=this._id) + span.sidebar-list-item-description + = profile.fullname + | (<span class="username">{{ username }}</span>) + if Filter.members.isSelected _id + i.fa.fa-check if Filter.isActive hr a.sidebar-btn.js-clear-all @@ -55,19 +54,18 @@ template(name="multiselectionSidebar") i.fa.fa-ellipsis-h hr ul.sidebar-list - each currentBoard.members - if isActive - with getUser userId - li(class="{{#if Filter.members.isSelected _id}}active{{/if}}") - a.name.js-toggle-member-multiselection - +userAvatar(userId=this._id) - span.sidebar-list-item-description - = profile.fullname - | (<span class="username">{{ username }}</span>) - if allSelectedElementHave 'member' _id - i.fa.fa-check - else if someSelectedElementHave 'member' _id - i.fa.fa-ellipsis-h + each currentBoard.activeMembers + with getUser userId + li(class="{{#if Filter.members.isSelected _id}}active{{/if}}") + a.name.js-toggle-member-multiselection + +userAvatar(userId=this._id) + span.sidebar-list-item-description + = profile.fullname + | (<span class="username">{{ username }}</span>) + if allSelectedElementHave 'member' _id + i.fa.fa-check + else if someSelectedElementHave 'member' _id + i.fa.fa-ellipsis-h hr a.sidebar-btn.js-archive-selection i.fa.fa-archive |